Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/22612
Change subject: amd/stoneyridge/dimm_spd.c: Fix dereference before NULL check ......................................................................
amd/stoneyridge/dimm_spd.c: Fix dereference before NULL check
Coverity reported pointer dev being dereferenced when assigning pointer conf, before checking dev for NULL. Pointer dev must be NULL checked before assigning a value to pointer conf.
BUG=b:69669995
Change-Id: Ic435b1290c9d3667b890ecc29c5147a25c16b96f Signed-off-by: Richard Spiegel richard.spiegel@silverbackltd.com --- M src/soc/amd/stoneyridge/dimm_spd.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/22612/1
diff --git a/src/soc/amd/stoneyridge/dimm_spd.c b/src/soc/amd/stoneyridge/dimm_spd.c index d9f6355..26cd335 100644 --- a/src/soc/amd/stoneyridge/dimm_spd.c +++ b/src/soc/amd/stoneyridge/dimm_spd.c @@ -26,9 +26,12 @@ { uint8_t spd_address; DEVTREE_CONST struct device *dev = dev_find_slot(0, DCT_DEVFN); - DEVTREE_CONST struct soc_amd_stoneyridge_config *conf = dev->chip_info; + DEVTREE_CONST struct soc_amd_stoneyridge_config *conf;
- if ((dev == 0) || (conf == 0)) + if (dev == 0) + return AGESA_ERROR; + conf = dev->chip_info; + if (conf == 0) return AGESA_ERROR; if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup)) return AGESA_ERROR;