Tim Wawrzynczak has uploaded this change for review.

View Change

util/sconfig: Fix null pointer dereferences

Should use `name` instead of `field->name`, because `field is supposed
to be NULL at this point.

TEST=add new field from bits 29-64 to volteer, ensure sconfig prints an
error instead of segfaulting.

Change-Id: I933330494e0b10e8494a92e93d6beb58fbec0bc1
Found-by: Coverity CID 1452916
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
---
M util/sconfig/main.c
1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/52888/1
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 111bb50..e2a0586 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -450,7 +450,7 @@
tmp = bits;
while (tmp) {
if (tmp->start_bit > tmp->end_bit || tmp->end_bit > 63) {
- printf("ERROR: fw_config field %s has invalid range %u-%u\n", field->name,
+ printf("ERROR: fw_config field %s has invalid range %u-%u\n", name,
tmp->start_bit, tmp->end_bit);
exit(1);
}

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I933330494e0b10e8494a92e93d6beb58fbec0bc1
Gerrit-Change-Number: 52888
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-MessageType: newchange