[coreboot-gerrit] Change in coreboot[master]: cbmem_console: Fix undefined behavior
Ryan Salsamendi (Code Review)
gerrit at coreboot.org
Sat Jun 10 04:58:24 CEST 2017
Ryan Salsamendi has uploaded this change for review. ( https://review.coreboot.org/20144
Change subject: cbmem_console: Fix undefined behavior
......................................................................
cbmem_console: Fix undefined behavior
Fixes report found by undefined behavior sanitizer. Left shifts of ints
where the right operand is >= width of type are undefined. Add
ul suffix since it's safe for unsigned types.
Change-Id: I4b2365428e421085285006bc1ea8aea75890ff65
Signed-off-by: Ryan Salsamendi <rsalsamendi at hotmail.com>
---
M src/lib/cbmem_console.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/20144/1
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index b0008b1..b1be8a9 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -47,7 +47,7 @@
#define MAX_SIZE (1 << 28) /* can't be changed without breaking readers! */
#define CURSOR_MASK (MAX_SIZE - 1) /* bits 31-28 are reserved for flags */
-#define OVERFLOW (1 << 31) /* set if in ring-buffer mode */
+#define OVERFLOW (1ul << 31) /* set if in ring-buffer mode */
_Static_assert(CONFIG_CONSOLE_CBMEM_BUFFER_SIZE <= MAX_SIZE,
"cbmem_console format cannot support buffers larger than 256MB!");
--
To view, visit https://review.coreboot.org/20144
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b2365428e421085285006bc1ea8aea75890ff65
Gerrit-Change-Number: 20144
Gerrit-PatchSet: 1
Gerrit-Owner: Ryan Salsamendi <rsalsamendi at hotmail.com>
More information about the coreboot-gerrit
mailing list