diff mbox

[U-Boot,04/11] powerpc/mpc85xx: check number of cores

Message ID 1345228043-30277-4-git-send-email-yorksun@freescale.com
State Superseded, archived
Delegated to: Andy Fleming
Headers show

Commit Message

York Sun Aug. 17, 2012, 6:27 p.m. UTC
Panic if the number of cores is more than CONFIG_MAX_CPUS because it will
surely overflow gd structure.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/cpu.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff mbox

Patch

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:");