[git commit] uevent: placate gcc

Denys Vlasenko vda.linux at googlemail.com
Wed Aug 16 09:45:09 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=c4367d72272f72f647d7847129164901f3d47955
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

How sizeof() can be an aliasing problem?

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 util-linux/uevent.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index 252e8fb..7ff866c 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -32,7 +32,10 @@
 #define env ((char **)bb_common_bufsiz1)
 #define INIT_G() do { setup_common_bufsiz(); } while (0)
 enum {
-	MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1,
+	MAX_ENV = COMMON_BUFSIZE / sizeof(char*) - 1,
+	/* sizeof(env[0]) instead of sizeof(char*)
+	 * makes gcc-6.3.0 emit "strict-aliasing" warning.
+	 */
 };
 
 #ifndef SO_RCVBUFFORCE


More information about the busybox-cvs mailing list