diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-05-04 10:08:10 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-05-05 20:26:38 +0000 |
commit | 54c3662a571a6c95bffbaf117a5c5c9255b18917 (patch) | |
tree | 40f2e2074d9444f7f58805cd2b8cbf2efcf70fce | |
parent | cdae2d9cdf928ba27ae1afa3b91ed1207f043de1 (diff) |
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>
-rw-r--r-- | util/sconfig/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 111bb502d7..e2a05862bf 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -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); } |