[coreboot-gerrit] New patch to review for coreboot: util/romcc: avoid shifting more than the variable's width

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Mon Jan 2 19:26:07 CET 2017


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18014

-gerrit

commit d00268dd99d05a419b9afad50d60667dad8b4c60
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Mon Jan 2 18:47:50 2017 +0100

    util/romcc: avoid shifting more than the variable's width
    
    That's undefined behavior in C
    
    Change-Id: I671ed8abf02e57a7cc993d1a85354e905f51717d
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Found-by: Coverity Scan #1229557
---
 util/romcc/romcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index cc1a3ac..871dde1 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -10023,7 +10023,7 @@ static void simplify_copy(struct compile_state *state, struct triple *ins)
 			/* Ensure I am properly sign extended */
 			if (size_of(state, right->type) < size_of(state, ins->type) &&
 				is_signed(right->type)) {
-				long_t val;
+				uint64_t val;
 				int shift;
 				shift = SIZEOF_LONG - size_of(state, right->type);
 				val = left;



More information about the coreboot-gerrit mailing list