[coreboot-gerrit] Change in coreboot[master]: southbridge/intel/lynxpoint: Fix undefined behavior

Ryan Salsamendi (Code Review) gerrit at coreboot.org
Sat Jul 1 03:21:01 CEST 2017


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


Change subject: southbridge/intel/lynxpoint: Fix undefined behavior
......................................................................

southbridge/intel/lynxpoint: Fix undefined behavior

Fixes report found by undefined behavior sanitizer. Dereferencing a
pointer that is not aligned to the size of access is undefined behavior.

Change-Id: Ia3c95e36e8b7f88ed69d5339e299c40934cb87da
Signed-off-by: Ryan Salsamendi <rsalsamendi at hotmail.com>
---
M src/southbridge/intel/lynxpoint/lpc.c
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/46/20446/1

diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index 6c4acd8..37cd94b 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -277,9 +277,9 @@
 	reg32 |= (1 << 4)|(1 << 5)|(1 << 0);
 	RCBA32(0x3310) = reg32;
 
-	reg32 = RCBA32(0x3f02);
-	reg32 &= ~0xf;
-	RCBA32(0x3f02) = reg32;
+	reg16 = RCBA16(0x3f02);
+	reg16 &= ~0xf;
+	RCBA16(0x3f02) = reg16;
 }
 
 static void pch_rtc_init(struct device *dev)

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3c95e36e8b7f88ed69d5339e299c40934cb87da
Gerrit-Change-Number: 20446
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/20170701/0ca02bea/attachment-0001.html>


More information about the coreboot-gerrit mailing list