Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32917
Change subject: util/romcc: Add extra null pointer check ......................................................................
util/romcc: Add extra null pointer check
It is possible that 'lnode->val' is set to 0 on a previous iteration of the loop, so check that it is non-null here before dereferencing it.
Change-Id: I9827dd5623eaf11240df605a8b50ff9e27a5fce0 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1129149 --- M util/romcc/romcc.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/32917/1
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index b9ec835..f8f8374 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -20935,7 +20935,8 @@ } } /* meet(const, const) = const or lattice low */ - else if (!constants_equal(state, lnode->val, tmp->val)) { + else if (lnode->val != 0 && + !constants_equal(state, lnode->val, tmp->val)) { lnode->val = 0; }
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32917 )
Change subject: util/romcc: Add extra null pointer check ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32917 )
Change subject: util/romcc: Add extra null pointer check ......................................................................
util/romcc: Add extra null pointer check
It is possible that 'lnode->val' is set to 0 on a previous iteration of the loop, so check that it is non-null here before dereferencing it.
Change-Id: I9827dd5623eaf11240df605a8b50ff9e27a5fce0 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1129149 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32917 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M util/romcc/romcc.c 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index d60a9a7..2a158e5 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -20944,7 +20944,8 @@ } } /* meet(const, const) = const or lattice low */ - else if (!constants_equal(state, lnode->val, tmp->val)) { + else if (lnode->val != 0 && + !constants_equal(state, lnode->val, tmp->val)) { lnode->val = 0; }