summaryrefslogtreecommitdiffstats
path: root/ichspi.c
diff options
context:
space:
mode:
authorEshan Kelkar <eshankelkar@galorithm.com>2023-01-12 19:32:45 +0530
committerAnastasia Klimchuk <aklm@chromium.org>2023-06-21 02:02:05 +0000
commit7887df98b38d011d52decdae0e5e02da15abd5ce (patch)
treee4c208847906b2c3529e2995deec01b646b1dc96 /ichspi.c
parent885f7923265e4e48f4bfc109f3723bb9167b75bc (diff)
downloadflashrom-7887df98b38d011d52decdae0e5e02da15abd5ce.tar.gz
flashrom-7887df98b38d011d52decdae0e5e02da15abd5ce.tar.bz2
flashrom-7887df98b38d011d52decdae0e5e02da15abd5ce.zip
ichspi.c: Bug fix for ich_hwseq_get_flash_id
In ich_hwseq_get_flash_id, flash_id_to_entry would return address of a structure present in flashchips array corresponding to provided manufacture_id and model_id. If this function returns NULL and if we don't return after printing the warning using msg_pwarn, we'll be dereferencing a NULL pointer, hence the return in that if is provided. Change-Id: I35c112cd032e3b94e30c347766764392d5bbfe3d Signed-off-by: Eshan Kelkar <eshangalorithm@gmail.com> Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/71872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Diffstat (limited to 'ichspi.c')
-rw-r--r--ichspi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ichspi.c b/ichspi.c
index e9668ef21..2e38ff17c 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1566,6 +1566,7 @@ static void ich_hwseq_get_flash_id(struct flashctx *flash, enum ich_chipset ich_
if (!entry) {
msg_pwarn("Unable to identify chip, mfg_id: 0x%02"PRIx32", "
"model_id: 0x%02"PRIx32"\n", mfg_id, model_id);
+ return;
}
msg_pdbg("Chip identified: %s\n", entry->name);