m68k: mm: Fix ColdFire pgd_alloc()
authorWill Deacon <will@kernel.org>
Fri, 31 Jan 2020 12:45:33 +0000 (13:45 +0100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 10 Feb 2020 09:57:48 +0000 (10:57 +0100)
commitfd1aa6303c4d6f3c1489eadc5cc37e581c3b41ea
tree7d9b402b24ed45da5f96633612f44a152dbd37af
parent43f0f97dd6f033709079d4346d384160dc3fc68f
m68k: mm: Fix ColdFire pgd_alloc()

I also notice that building for m5475evb_defconfig with vanilla v5.5
triggers this scary looking warning due to a mismatch between the pgd
size and the (8k!) page size:

 | In function 'pgd_alloc.isra.111',
 |     inlined from 'mm_alloc_pgd' at kernel/fork.c:634:12,
 |     inlined from 'mm_init.isra.112' at kernel/fork.c:1043:6:
 | ./arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' forming offset [4097, 8192] is out of the bounds [0, 4096] of object 'kernel_pg_dir' with type 'pgd_t[1024]' {aka 'struct <anonymous>[1024]'} [-Warray-bounds]
 |  #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
 | ./arch/m68k/include/asm/mcf_pgalloc.h:93:2: note: in expansion of macro 'memcpy'
 |   memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
 |   ^~~~~~

Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Tested-by: Greg Ungerer <gerg@linux-m68k.org>
Link: https://lore.kernel.org/r/20200131125403.540057688@infradead.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/include/asm/mcf_pgalloc.h