netfs: Mark __nonstring lookup tables
Subsystems (2)
PATCH 1/1 netfs: Mark __nonstring lookup tables
GCC 15's new -Wunterminated-string-initialization notices that the character lookup tables "fscache_cache_states" and "fscache_cookie_states" (which are not used as a C-String) need to be marked as "nonstring":
fs/netfs/fscache_cache.c:375:67: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (6 chars into 5 available) [-Wunterminated-string-initialization]
375 | static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] = "-PAEW";
| ^~~~~~~fs/netfs/fscache_cookie.c:32:69: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (11 chars into 10 available) [-Wunterminated-string-initialization]
32 | static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] = "-LCAIFUWRD";
| ^~~~~~~~~~~~
Annotate the arrays.
---
Cc: David Howells <[email protected]>
Cc: Paulo Alcantara <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- fs/netfs/fscache_cache.c | 2 +- fs/netfs/fscache_cookie.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/netfs/fscache_cache.c +1 -1
@@ -372,7 +372,7 @@ void fscache_withdraw_cache(struct fscache_cache *cache)EXPORT_SYMBOL (fscache_withdraw_cache);#ifdef CONFIG_PROC_FS -static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE ] ="-PAEW" ; +static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] __nonstring = "-PAEW";/* * Generate a list of caches in /proc/fs/fscache/caches
fs/netfs/fscache_cookie.c +1 -1
@@ -29,7 +29,7 @@ static LIST_HEAD(fscache_cookie_lru);static DEFINE_SPINLOCK (fscache_cookie_lru_lock);DEFINE_TIMER (fscache_cookie_lru_timer, fscache_cookie_lru_timed_out); static DECLARE_WORK(fscache_cookie_lru_work, fscache_cookie_lru_worker); -static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR ] ="-LCAIFUWRD" ; +static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] __nonstring = "-LCAIFUWRD";static unsigned int fscache_lru_cookie_timeout =10 *HZ ;void fscache_print_cookie (struct fscache_cookie *cookie,char prefix)
Signature · 1 line
2.34.1
Quoted 4 lines · Kees Cook
GCC 15's new -Wunterminated-string-initialization notices that the character lookup tables "
fscache_cache_states" and "fscache_cookie_states" (which are not used as a C-String) need to be marked as "nonstring":
Quoted 8 lines
fs/netfs/fscache_cache.c:375:67: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (6 chars into 5 available) [-Wunterminated-string-initialization]
375 | static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] = "-PAEW";
| ^~~~~~~fs/netfs/fscache_cookie.c:32:69: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (11 chars into 10 available) [-Wunterminated-string-initialization]
32 | static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] = "-LCAIFUWRD";
| ^~~~~~~~~~~~[...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] netfs: Mark __nonstring lookup tables
https://git.kernel.org/vfs/vfs/c/58db1c3cd0ce