x86/mm/init.c: Fix devmem_is_allowed() off by one
authorT Makphaibulchoke <tmac@hp.com>
Wed, 29 Aug 2012 03:21:43 +0000 (21:21 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 18 Jul 2017 17:38:44 +0000 (18:38 +0100)
commit 73e8f3d7e2cb23614d5115703d76d8e54764b641 upstream.

Fixing an off-by-one error in devmem_is_allowed(), which allows
accesses to physical addresses 0x100000-0x100fff, an extra page
past 1MB.

Signed-off-by: T Makphaibulchoke <tmac@hp.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: yinghai@kernel.org
Cc: tiwai@suse.de
Cc: dhowells@redhat.com
Link: http://lkml.kernel.org/r/1346210503-14276-1-git-send-email-tmac@hp.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/mm/init.c

index a4cca06..222f5b7 100644 (file)
@@ -326,7 +326,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
  */
 int devmem_is_allowed(unsigned long pagenr)
 {
  */
 int devmem_is_allowed(unsigned long pagenr)
 {
-       if (pagenr <= 256)
+       if (pagenr < 256)
                return 1;
        if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
                return 0;
                return 1;
        if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
                return 0;