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>
This commit is contained in:
Jacob Garber 2019-05-21 14:42:24 -06:00 committed by Patrick Georgi
parent 9742ae1d11
commit 298afb3140
1 changed files with 2 additions and 1 deletions

View File

@ -20944,7 +20944,8 @@ static void scc_visit_phi(struct compile_state *state, struct scc_state *scc,
} }
} }
/* meet(const, const) = const or lattice low */ /* 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; lnode->val = 0;
} }