Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/58427 )
Change subject: trace: Avoid propagating unintended sign extension ......................................................................
trace: Avoid propagating unintended sign extension
The alternative would be to add casts to unsigned types in the preceding statements (pretty much everywhere), so this seems like the easier approach.
Signed-off-by: Patrick Georgi pgeorgi@google.com Change-Id: I1dba945ce86fc6a080725fd2f913abbbbc10191e Reviewed-on: https://review.coreboot.org/c/em100/+/58427 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M trace.c 1 file changed, 3 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved
diff --git a/trace.c b/trace.c index c04afcc..038488a 100644 --- a/trace.c +++ b/trace.c @@ -275,6 +275,9 @@ + (data[i * 8 + 7] << 8) + data[i * 8 + 8];
+ /* truncate any potential sign extension */ + address &= 0xffffffff; + /* skip address bytes and padding */ j += address_bytes + spi_cmd_vals->pad_bytes;