]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sunrpc: avoid -Wformat-security warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 19 Jul 2024 10:54:22 +0000 (12:54 +0200)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 19 Jul 2024 14:05:23 +0000 (10:05 -0400)
Using a non-constant string as an sprintf-style is potentially dangerous:

net/sunrpc/svc.c: In function 'param_get_pool_mode':
net/sunrpc/svc.c:164:32: error: format not a string literal and no format arguments [-Werror=format-security]

Use a literal "%s" format instead.

Fixes: 5f71f3c32553 ("sunrpc: refactor pool_mode setting code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
net/sunrpc/svc.c

index e03f14024e471d3104b08ca99375ab6d871577a5..88a59cfa5583c064d02df1b3632cb6021a24390d 100644 (file)
@@ -161,7 +161,7 @@ param_get_pool_mode(char *buf, const struct kernel_param *kp)
        str[len] = '\n';
        str[len + 1] = '\0';
 
-       return sysfs_emit(buf, str);
+       return sysfs_emit(buf, "%s", str);
 }
 
 module_param_call(pool_mode, param_set_pool_mode, param_get_pool_mode,