All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] fs: cramfs_fs.h: Fix shifting signed 32-bit value by 31 bits problem
@ 2019-06-16 16:27 ` Puranjay Mohan
  0 siblings, 0 replies; 2+ messages in thread
From: puranjay12 @ 2019-06-16 16:27 UTC (permalink / raw)


Fix CRAMFS_BLK_FLAG_UNCOMPRESSED 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: Puranjay Mohan <puranjay12 at gmail.com>
---
 include/uapi/linux/cramfs_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/cramfs_fs.h b/include/uapi/linux/cramfs_fs.h
index 6713669aa2ed..31df3e185b62 100644
--- a/include/uapi/linux/cramfs_fs.h
+++ b/include/uapi/linux/cramfs_fs.h
@@ -98,7 +98,7 @@ struct cramfs_super {
  *
  * That leaves room for 3 flag bits in the block pointer table.
  */
-#define CRAMFS_BLK_FLAG_UNCOMPRESSED	(1 << 31)
+#define CRAMFS_BLK_FLAG_UNCOMPRESSED	(1U << 31)
 #define CRAMFS_BLK_FLAG_DIRECT_PTR	(1 << 30)
 
 #define CRAMFS_BLK_FLAGS	( CRAMFS_BLK_FLAG_UNCOMPRESSED \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Linux-kernel-mentees] [PATCH] fs: cramfs_fs.h: Fix shifting signed 32-bit value by 31 bits problem
@ 2019-06-16 16:27 ` Puranjay Mohan
  0 siblings, 0 replies; 2+ messages in thread
From: Puranjay Mohan @ 2019-06-16 16:27 UTC (permalink / raw)


Fix CRAMFS_BLK_FLAG_UNCOMPRESSED 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: Puranjay Mohan <puranjay12 at gmail.com>
---
 include/uapi/linux/cramfs_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/cramfs_fs.h b/include/uapi/linux/cramfs_fs.h
index 6713669aa2ed..31df3e185b62 100644
--- a/include/uapi/linux/cramfs_fs.h
+++ b/include/uapi/linux/cramfs_fs.h
@@ -98,7 +98,7 @@ struct cramfs_super {
  *
  * That leaves room for 3 flag bits in the block pointer table.
  */
-#define CRAMFS_BLK_FLAG_UNCOMPRESSED	(1 << 31)
+#define CRAMFS_BLK_FLAG_UNCOMPRESSED	(1U << 31)
 #define CRAMFS_BLK_FLAG_DIRECT_PTR	(1 << 30)
 
 #define CRAMFS_BLK_FLAGS	( CRAMFS_BLK_FLAG_UNCOMPRESSED \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-16 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 16:27 [Linux-kernel-mentees] [PATCH] fs: cramfs_fs.h: Fix shifting signed 32-bit value by 31 bits problem puranjay12
2019-06-16 16:27 ` Puranjay Mohan

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.