Anastasia Klimchuk submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nikolai Artemiev: Looks good to me, approved
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>
---
M ichspi.c
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/ichspi.c b/ichspi.c
index e9668ef..2e38ff1 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1566,6 +1566,7 @@
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);

To view, visit change 71872. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I35c112cd032e3b94e30c347766764392d5bbfe3d
Gerrit-Change-Number: 71872
Gerrit-PatchSet: 3
Gerrit-Owner: eshankelkar@galorithm.com
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged