From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Sun Date: Mon, 8 Oct 2012 10:44:10 -0700 Subject: [U-Boot] [PATCH 07/28] powerpc/mpc85xx: check number of cores In-Reply-To: <1349718271-26503-1-git-send-email-yorksun@freescale.com> References: <1349718271-26503-1-git-send-email-yorksun@freescale.com> Message-ID: <1349718271-26503-7-git-send-email-yorksun@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Panic if the number of cores is more than CONFIG_MAX_CPUS because it will surely overflow gd structure. Signed-off-by: York Sun --- arch/powerpc/cpu/mpc85xx/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index 515dd41..11b83d2 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -127,6 +127,11 @@ int checkcpu (void) printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr); + if (nr_cores > CONFIG_MAX_CPUS) { + panic("\nUnexpected number of cores: %d, max is %d\n", + nr_cores, CONFIG_MAX_CPUS); + } + get_sys_info(&sysinfo); puts("Clock Configuration:"); -- 1.7.9.5