]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
linux: Fix integer overflow warnings when including <sys/mount.h> [BZ #32708]
authorCollin Funk <collin.funk1@gmail.com>
Tue, 25 Mar 2025 15:17:55 +0000 (11:17 -0400)
committerCarlos O'Donell <carlos@redhat.com>
Wed, 26 Mar 2025 03:55:08 +0000 (23:55 -0400)
Using gcc -Wshift-overflow=2 -Wsystem-headers to compile a file
including <sys/mount.h> will cause a warning since 1 << 31 is undefined
behavior on platforms where int is 32-bits.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
sysdeps/unix/sysv/linux/sys/mount.h

index 7c6d0805d7abf20dfa8cf4ae5068c2dc6c51d7bb..b549e75148c0fcbe67f52f3ffeb7ce2d5368be8e 100644 (file)
@@ -121,7 +121,7 @@ enum
   MS_ACTIVE = 1 << 30,
 #define MS_ACTIVE      MS_ACTIVE
 #undef MS_NOUSER
-  MS_NOUSER = 1 << 31
+  MS_NOUSER = 1U << 31
 #define MS_NOUSER      MS_NOUSER
 };