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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52888
Reviewed-by: Duncan Laurie
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Tim Wawrzynczak 2021-05-04 10:08:10 -06:00 committed by Felix Held
parent cdae2d9cdf
commit 54c3662a57
1 changed files with 1 additions and 1 deletions

View File

@ -450,7 +450,7 @@ struct fw_config_field *new_fw_config_field(const char *name, struct fw_config_f
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);
}