Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: add printf attribute to shrinker_debugfs_name_alloc

This fixes a compiler warning when compiling an allyesconfig with W=1:

mm/internal.h:1235:9: error: function might be a candidate for `gnu_printf'
format attribute [-Werror=suggest-attribute=format]

[akpm@linux-foundation.org: fix shrinker_alloc() as welll per Qi Zheng]
Link: https://lkml.kernel.org/r/822387b7-4895-4e64-5806-0f56b5d6c447@bytedance.com
Link: https://lkml.kernel.org/r/ZSBue-3kM6gI6jCr@mainframe
Fixes: c42d50aefd17 ("mm: shrinker: add infrastructure for dynamically allocating shrinker")
Signed-off-by: Lucy Mielke <lucymielke@icloud.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lucy Mielke and committed by
Andrew Morton
f04eba13 7a81751f

+3 -2
+1
include/linux/shrinker.h
··· 131 131 */ 132 132 #define SHRINKER_NONSLAB BIT(4) 133 133 134 + __printf(2, 3) 134 135 struct shrinker *shrinker_alloc(unsigned int flags, const char *fmt, ...); 135 136 void shrinker_register(struct shrinker *shrinker); 136 137 void shrinker_free(struct shrinker *shrinker);
+2 -2
mm/internal.h
··· 1219 1219 int priority); 1220 1220 1221 1221 #ifdef CONFIG_SHRINKER_DEBUG 1222 - static inline int shrinker_debugfs_name_alloc(struct shrinker *shrinker, 1223 - const char *fmt, va_list ap) 1222 + static inline __printf(2, 0) int shrinker_debugfs_name_alloc( 1223 + struct shrinker *shrinker, const char *fmt, va_list ap) 1224 1224 { 1225 1225 shrinker->name = kvasprintf_const(GFP_KERNEL, fmt, ap); 1226 1226