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; }