klibc-bot for Florent Revest
2025-Jul-27 16:12 UTC
[klibc] [klibc:master] mount_opts: Fix the mount_opts str length
Commit-ID: f7d9399d1035d2a70067fa6995db7ea02ed0c311
Gitweb:
http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=f7d9399d1035d2a70067fa6995db7ea02ed0c311
Author: Florent Revest <revest at chromium.org>
AuthorDate: Thu, 10 Jul 2025 19:39:11 +0200
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 12 Jul 2025 18:40:52 +0200
[klibc] mount_opts: Fix the mount_opts str length
Newer versions of LLVM report:
usr/utils/mount_opts.c:20:3: error: initializer-string for character array is
too long, array size is 8 but initializer has size 9 (including the null
terminating character); did you mean to use the 'nonstring' attribute?
[-Werror,-Wunterminated-string-initialization]
20 | {"diratime", MS_NODIRATIME, 0, MS_NODIRATIME},
| ^~~~~~~~~~
This is indeed a bit odd. "diratime" is 9 bytes long with the \0
terminator but placed into a struct that uses a static length of 8 bytes
for that buffer. I suppose this can cause all sorts of undefined
behaviors in theory but that in practice this never caused anything bad
because the next field is an unsigned long containing 2048 so the upper
bytes are 0 and act as string terminators by chance.
Anyway, fixing this helps unblock builds with newer toolchains.
Signed-off-by: Florent Revest <revest at chromium.org>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/utils/mount_opts.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/utils/mount_opts.h b/usr/utils/mount_opts.h
index cf47cae8..5195c88a 100644
--- a/usr/utils/mount_opts.h
+++ b/usr/utils/mount_opts.h
@@ -2,7 +2,7 @@
#define UTILS_MOUNT_OPTS_H
struct mount_opts {
- const char str[8];
+ const char str[9];
unsigned long rwmask;
unsigned long rwset;
unsigned long rwnoset;