From: York Sun Date: Thu, 26 May 2011 23:25:50 +0000 (+0800) Subject: powerpc/mpc8xxx: check SPD length before using part number X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=d2246549c7a71a3fca240e78bbcda6951195cfe3;p=u-boot.git powerpc/mpc8xxx: check SPD length before using part number Only use DDR DIMM part number if SPD has valid length, to prevent from display garbage in case SPD doesn't cover these fields. Signed-off-by: York Sun Signed-off-by: Kumar Gala --- diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c b/arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c index 756b15f7ab..838cebed57 100644 --- a/arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c +++ b/arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c @@ -114,7 +114,8 @@ ddr_compute_dimm_parameters(const ddr3_spd_eeprom_t *spd, * and copying the part name in ASCII from the SPD onto it */ memset(pdimm->mpart, 0, sizeof(pdimm->mpart)); - memcpy(pdimm->mpart, spd->mpart, sizeof(pdimm->mpart) - 1); + if ((spd->info_size_crc & 0xF) > 1) + memcpy(pdimm->mpart, spd->mpart, sizeof(pdimm->mpart) - 1); /* DIMM organization parameters */ pdimm->n_ranks = ((spd->organization >> 3) & 0x7) + 1;