]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ARM: 8740/1: NOMMU: Make sure we do not hold stale data in mem[] array
authorVladimir Murzin <vladimir.murzin@arm.com>
Wed, 3 Jan 2018 09:09:33 +0000 (10:09 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Sun, 21 Jan 2018 15:32:24 +0000 (15:32 +0000)
adjust_lowmem_bounds() called twice which can lead to stalled data
(i.e. subreg) value in mem[] array after the first call.

Zero out mem[] array before we allocate MPU regions for memory.

Fixes: 5c9d9a1b3a54 ("ARM: 8712/1: NOMMU: Use more MPU regions to cover memory")
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/mm/pmsa-v7.c

index 650998912c1c4c034ab4acd9b86f32bbd661952d..e2853bfff74ecdbea4e5c6b0c33ace5df8ccd618 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/bitops.h>
 #include <linux/memblock.h>
+#include <linux/string.h>
 
 #include <asm/cacheflush.h>
 #include <asm/cp15.h>
@@ -296,6 +297,7 @@ void __init adjust_lowmem_bounds_mpu(void)
                }
        }
 
+       memset(mem, 0, sizeof(mem));
        num = allocate_region(mem_start, specified_mem_size, mem_max_regions, mem);
 
        for (i = 0; i < num; i++) {