device/dram/ddr3.c: Fix sizeof on array func param overflow
The sizeof on array function parameter will return size of 'u8 *' instead of 'spd_raw_data' (aka 'u8 [256]' leading to an overflow. Found-by: Clang Change-Id: I78e113a640b2953c853eb43bd6874e4694260b1f Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-on: http://review.coreboot.org/7353 Tested-by: build bot (Jenkins) Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
@@ -127,7 +127,7 @@ int spd_decode_ddr3(dimm_attr * dimm, spd_raw_data spd)
|
|||||||
}
|
}
|
||||||
dimm->dram_type = SPD_MEMORY_TYPE_SDRAM_DDR3;
|
dimm->dram_type = SPD_MEMORY_TYPE_SDRAM_DDR3;
|
||||||
|
|
||||||
crc = spd_ddr3_calc_crc(spd, sizeof(spd));
|
crc = spd_ddr3_calc_crc(spd, sizeof(*spd));
|
||||||
/* Compare with the CRC in the SPD */
|
/* Compare with the CRC in the SPD */
|
||||||
spd_crc = (spd[127] << 8) + spd[126];
|
spd_crc = (spd[127] << 8) + spd[126];
|
||||||
/* Verify the CRC is correct */
|
/* Verify the CRC is correct */
|
||||||
|
Reference in New Issue
Block a user