[coreboot-gerrit] Change in coreboot[master]: cpu/intel/haswell: Fix undefined behavior

Ryan Salsamendi (Code Review) gerrit at coreboot.org
Tue Jul 4 22:58:23 CEST 2017


Ryan Salsamendi has uploaded this change for review. ( https://review.coreboot.org/20467


Change subject: cpu/intel/haswell: Fix undefined behavior
......................................................................

cpu/intel/haswell: Fix undefined behavior

Fix undefined behavior found by clang's -Wshift-sign-overflow. Left
shifting an int where the right operand is >= the width of the type
is undefined. Add UL suffix since it's safe for unsigned types.

Change-Id: Ieacf83d052bf4abfad639ef8e592bd8de17d16e6
Signed-off-by: Ryan Salsamendi <rsalsamendi at hotmail.com>
---
M src/cpu/intel/haswell/haswell.h
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/20467/1

diff --git a/src/cpu/intel/haswell/haswell.h b/src/cpu/intel/haswell/haswell.h
index 608c5b5..6612509 100644
--- a/src/cpu/intel/haswell/haswell.h
+++ b/src/cpu/intel/haswell/haswell.h
@@ -112,7 +112,7 @@
 
 /* PCODE MMIO communications live in the MCHBAR. */
 #define BIOS_MAILBOX_INTERFACE			0x5da4
-#define  MAILBOX_RUN_BUSY			(1 << 31)
+#define  MAILBOX_RUN_BUSY			(1UL << 31)
 #define  MAILBOX_BIOS_CMD_READ_PCS		1
 #define  MAILBOX_BIOS_CMD_WRITE_PCS		2
 #define  MAILBOX_BIOS_CMD_READ_CALIBRATION	0x509

-- 
To view, visit https://review.coreboot.org/20467
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieacf83d052bf4abfad639ef8e592bd8de17d16e6
Gerrit-Change-Number: 20467
Gerrit-PatchSet: 1
Gerrit-Owner: Ryan Salsamendi <rsalsamendi at hotmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170704/e5b18646/attachment.html>


More information about the coreboot-gerrit mailing list