Skip to contentSkip to conversation

media: media.h: Fix shifting signed 32-bit value by 31 bits problem

PATCH New Shuah Khan 1 participant 1 message Jun 13, 2019

Subsystems (2)
lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

PATCH 1/1 media: media.h: Fix shifting signed 32-bit value by 31 bits problem

Fix MEDIA_ENT_ID_FLAG_NEXT to use "U" cast to avoid shifting signed 32-bit value by 31 bits problem. This isn't a problem for kernel builds with gcc.

This could be problem since this header is part of public API which could be included for builds using compilers that don't handle this condition safely resulting in undefined behavior.

---
 include/uapi/linux/media.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/media.h +1 -1
index 9aedb187bc48..383ac7b7d8f0 100644
@@ -146,7 +146,7 @@ struct media_device_info {
 #define MEDIA_ENT_FL_CONNECTOR			(1 << 1)
 
 /* OR with the entity id value to find the next entity */
-#define MEDIA_ENT_ID_FLAG_NEXT			(1 << 31)
+#define MEDIA_ENT_ID_FLAG_NEXT			(1U << 31)
 
 struct media_entity_desc {
 	__u32 id;
Signature · 1 line
2.17.1