[coreboot-gerrit] Patch set updated for coreboot: util/romcc: avoid shifting more than the variable's width
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Wed Jan 4 21:12:23 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 9a9c7bf3abd75d676befd8d362c1cd2412355f16
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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 4f6a6cb..33707b7 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -10021,13 +10021,13 @@ 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;
val <<= shift;
val >>= shift;
- left = val;
+ left = (ulong_t)val;
}
mkconst(state, ins, left);
break;
More information about the coreboot-gerrit
mailing list