summaryrefslogtreecommitdiff
path: root/firmware/kernel/include/queue.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-17 16:15:09 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-04-17 11:37:34 -0400
commitfca7b8e2ff400cfe6307f138c688cc1dcd875ce9 (patch)
tree6a3df9679649fdcf2135e9a283b0e618ebf3bd6a /firmware/kernel/include/queue.h
parentc6df8cc4f7cdbff2bf86d40be3ee1e9daae6c9b6 (diff)
downloadrockbox-fca7b8e2ff400cfe6307f138c688cc1dcd875ce9.tar.gz
rockbox-fca7b8e2ff400cfe6307f138c688cc1dcd875ce9.zip
Fix undefined behavior that blocks compiling with UBSan
Left shifts are not defined in C if they would cause signed overflow, so these expressions get instrumented, which makes them unusable as switch values and triggers compile errors when compiling with UBSan. Change-Id: I0588d4be1e00ba1cfde0eac119ead368b20d10c9
Diffstat (limited to 'firmware/kernel/include/queue.h')
-rw-r--r--firmware/kernel/include/queue.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/kernel/include/queue.h b/firmware/kernel/include/queue.h
index 6740b88760..a9c3b5a93a 100644
--- a/firmware/kernel/include/queue.h
+++ b/firmware/kernel/include/queue.h
@@ -38,7 +38,7 @@
38/* make sure SYS_EVENT_CLS_BITS has enough range */ 38/* make sure SYS_EVENT_CLS_BITS has enough range */
39 39
40/* Bit 31->|S|c...c|i...i| */ 40/* Bit 31->|S|c...c|i...i| */
41#define SYS_EVENT ((long)(int)(1 << 31)) 41#define SYS_EVENT ((long)(int)(1u << 31))
42#define SYS_EVENT_CLS_BITS (3) 42#define SYS_EVENT_CLS_BITS (3)
43#define SYS_EVENT_CLS_SHIFT (31-SYS_EVENT_CLS_BITS) 43#define SYS_EVENT_CLS_SHIFT (31-SYS_EVENT_CLS_BITS)
44#define SYS_EVENT_CLS_MASK (((1l << SYS_EVENT_CLS_BITS)-1) << SYS_EVENT_SHIFT) 44#define SYS_EVENT_CLS_MASK (((1l << SYS_EVENT_CLS_BITS)-1) << SYS_EVENT_SHIFT)