This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 2df1ecca3c8 semaphore.h: fix ubsan error
2df1ecca3c8 is described below
commit 2df1ecca3c8534e3ac361fe40bdfe7d042312c53
Author: hujun5 <[email protected]>
AuthorDate: Wed Jan 28 20:08:10 2026 +0800
semaphore.h: fix ubsan error
Replace left-shift of 1 by 31 bits with direct hexadecimal constant
to eliminate undefined behavior warning when left-shifting signed values
beyond their bit width on platforms with strict sanitizer checking.
Signed-off-by: hujun5 <[email protected]>
---
include/nuttx/semaphore.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h
index 1c3b3256dbf..fdf32534f46 100644
--- a/include/nuttx/semaphore.h
+++ b/include/nuttx/semaphore.h
@@ -66,7 +66,7 @@
/* Mutex related helper macros */
-#define NXSEM_MBLOCKING_BIT (((uint32_t)1) << 31)
+#define NXSEM_MBLOCKING_BIT ((uint32_t)0x80000000)
#define NXSEM_NO_MHOLDER ((uint32_t)0x7ffffffe)
#define NXSEM_MRESET ((uint32_t)0x7fffffff)