Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17887
-gerrit
commit 0a30d03b8337fdd67e9b65d7a1d5923edb81d3ec Author: Patrick Georgi pgeorgi@chromium.org Date: Thu Dec 15 15:24:06 2016 +0100
util/romcc: Don't read 'member' if it might be NULL
The earlier loop exits gracefully iff i == index. In other cases, member might be NULL, so check that the scan was successful before using its results.
Change-Id: I818c233d797d82fa819243c4626dd9c4b7de3ac6 Signed-off-by: Patrick Georgi pgeorgi@chromium.org Found-by: Coverity Scan #1129147 --- util/romcc/romcc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index 052be12..cc1a3ac 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -6406,11 +6406,10 @@ static size_t index_reg_offset(struct compile_state *state, i++; member = member->right; } - size += reg_needed_padding(state, member, size); if (i != index) { internal_error(state, 0, "Missing member index: %u", index); } - + size += reg_needed_padding(state, member, size); } else if ((type->type & TYPE_MASK) == TYPE_JOIN) { ulong_t i;