From 7887df98b38d011d52decdae0e5e02da15abd5ce Mon Sep 17 00:00:00 2001 From: Eshan Kelkar Date: Thu, 12 Jan 2023 19:32:45 +0530 Subject: [PATCH] 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 Signed-off-by: Anastasia Klimchuk Reviewed-on: https://review.coreboot.org/c/flashrom/+/71872 Tested-by: build bot (Jenkins) Reviewed-by: Nikolai Artemiev --- ichspi.c | 1 + 1 file changed, 1 insertion(+) 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);