Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/36947 )
Change subject: Fix iterating the chips array ......................................................................
Fix iterating the chips array
chip = chips; chip++ (a couple of times) "never" ends up being NULL (only after an address overflow). The array terminator is signified by .name = NULL, so test for that.
Signed-off-by: Patrick Georgi pgeorgi@google.com Found-by: Coverity Scan #264029 Change-Id: I7f9771ffb250bf01a8588bdb100e2f1586db4656 --- M em100.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/47/36947/1
diff --git a/em100.c b/em100.c index 07099aa..50b04b4 100644 --- a/em100.c +++ b/em100.c @@ -615,7 +615,7 @@ if (!read_fpga_register(em100, FPGA_REG_DEVID, &devid)) return 1;
- for (chip = chips; chip != NULL; chip++) { + for (chip = chips; chip->name != NULL; chip++) { uint16_t comp;
if (get_chip_init_val(chip, 0x23, FPGA_REG_DEVID, &comp) || devid != comp)
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/em100/+/36947 )
Change subject: Fix iterating the chips array ......................................................................
Patch Set 1: Code-Review+2
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/36947 )
Change subject: Fix iterating the chips array ......................................................................
Patch Set 1: Code-Review+2
Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/36947 )
Change subject: Fix iterating the chips array ......................................................................
Fix iterating the chips array
chip = chips; chip++ (a couple of times) "never" ends up being NULL (only after an address overflow). The array terminator is signified by .name = NULL, so test for that.
Signed-off-by: Patrick Georgi pgeorgi@google.com Found-by: Coverity Scan #264029 Change-Id: I7f9771ffb250bf01a8588bdb100e2f1586db4656 Reviewed-on: https://review.coreboot.org/c/em100/+/36947 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Jacob Garber jgarber1@ualberta.ca Reviewed-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M em100.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved Jacob Garber: Looks good to me, approved
diff --git a/em100.c b/em100.c index 07099aa..50b04b4 100644 --- a/em100.c +++ b/em100.c @@ -615,7 +615,7 @@ if (!read_fpga_register(em100, FPGA_REG_DEVID, &devid)) return 1;
- for (chip = chips; chip != NULL; chip++) { + for (chip = chips; chip->name != NULL; chip++) { uint16_t comp;
if (get_chip_init_val(chip, 0x23, FPGA_REG_DEVID, &comp) || devid != comp)