From fca7b8e2ff400cfe6307f138c688cc1dcd875ce9 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 17 Apr 2022 16:15:09 +0100 Subject: 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 --- firmware/kernel/include/queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'firmware/kernel/include/queue.h') 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 @@ /* make sure SYS_EVENT_CLS_BITS has enough range */ /* Bit 31->|S|c...c|i...i| */ -#define SYS_EVENT ((long)(int)(1 << 31)) +#define SYS_EVENT ((long)(int)(1u << 31)) #define SYS_EVENT_CLS_BITS (3) #define SYS_EVENT_CLS_SHIFT (31-SYS_EVENT_CLS_BITS) #define SYS_EVENT_CLS_MASK (((1l << SYS_EVENT_CLS_BITS)-1) << SYS_EVENT_SHIFT) -- cgit v1.2.3