1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

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>
This commit is contained in:
Eshan Kelkar 2023-01-12 19:32:45 +05:30 committed by Anastasia Klimchuk
parent 885f792326
commit 7887df98b3

View File

@ -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);