Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: fix ColdFire node shift size calculation

The m68k pg_data_table is a fix size array defined in arch/m68k/mm/init.c.
Index numbers within it are defined based on memory size. But for Coldfire
these don't take into account a non-zero physical RAM base address, and this
causes us to access past the end of this array at system start time.

Change the node shift calculation so that we keep the index inside its range.

Reported-by: Angelo Dureghello <angelo@sysam.it>
Tested-by: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>

+1 -1
+1 -1
arch/m68k/mm/mcfmmu.c
··· 170 170 max_pfn = max_low_pfn = PFN_DOWN(_ramend); 171 171 high_memory = (void *)_ramend; 172 172 173 - m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6; 173 + m68k_virt_to_node_shift = fls(_ramend - 1) - 6; 174 174 module_fixup(NULL, __start_fixup, __stop_fixup); 175 175 176 176 /* setup bootmem data */