All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: media.h: Fix shifting signed 32-bit value by 31 bits problem
@ 2019-06-13  0:56 Shuah Khan
  0 siblings, 0 replies; only message in thread
From: Shuah Khan @ 2019-06-13  0:56 UTC (permalink / raw)
  To: mchehab, hverkuil-cisco; +Cc: Shuah Khan, linux-media, linux-kernel

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.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 include/uapi/linux/media.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 9aedb187bc48..383ac7b7d8f0 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-13 16:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13  0:56 [PATCH] media: media.h: Fix shifting signed 32-bit value by 31 bits problem Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.