From 298afb3140fa8f092b356ec89d8be2f5a36b530f Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Tue, 21 May 2019 14:42:24 -0600 Subject: 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 Found-by: Coverity CID 1129149 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32917 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/romcc/romcc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/romcc') diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index d60a9a7f83..2a158e5fe0 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -20944,7 +20944,8 @@ static void scc_visit_phi(struct compile_state *state, struct scc_state *scc, } } /* 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; } -- cgit v1.2.3