Return-Path: From: alexander.levin@verizon.com Cc: Greg Ungerer , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 05/24] m68k: fix ColdFire node shift size calculation Date: Wed, 22 Nov 2017 22:26:11 +0000 Message-ID: <20171122222604.20122-5-alexander.levin@verizon.com> References: <20171122222604.20122-1-alexander.levin@verizon.com> In-Reply-To: <20171122222604.20122-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: From: Greg Ungerer [ Upstream commit f55ab8f27548ff3431a6567d400c6757c49fd520 ] 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 thi= s 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 rang= e. Reported-by: Angelo Dureghello Tested-by: Angelo Dureghello Signed-off-by: Greg Ungerer Signed-off-by: Sasha Levin --- arch/m68k/mm/mcfmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index 87131cd3bc8f..6d3a50446b21 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c @@ -169,7 +169,7 @@ void __init cf_bootmem_alloc(void) max_pfn =3D max_low_pfn =3D PFN_DOWN(_ramend); high_memory =3D (void *)_ramend; =20 - m68k_virt_to_node_shift =3D fls(_ramend - _rambase - 1) - 6; + m68k_virt_to_node_shift =3D fls(_ramend - 1) - 6; module_fixup(NULL, __start_fixup, __stop_fixup); =20 /* setup bootmem data */ --=20 2.11.0