[PATCH 3.2 89/95] x86/mm/init.c: Fix devmem_is_allowed() off by one
From: Ben Hutchings
Date: Sun Jul 16 2017 - 10:54:41 EST
3.2.91-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: T Makphaibulchoke <tmac@xxxxxx>
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@xxxxxx>
Acked-by: H. Peter Anvin <hpa@xxxxxxxxx>
Cc: yinghai@xxxxxxxxxx
Cc: tiwai@xxxxxxx
Cc: dhowells@xxxxxxxxxx
Link: http://lkml.kernel.org/r/1346210503-14276-1-git-send-email-tmac@xxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
arch/x86/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -326,7 +326,7 @@ unsigned long __init_refok init_memory_m
*/
int devmem_is_allowed(unsigned long pagenr)
{
- if (pagenr <= 256)
+ if (pagenr < 256)
return 1;
if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
return 0;