mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sunrpc: avoid -Wformat-security warning
@ 2024-07-19 10:54 Arnd Bergmann
  2024-07-19 11:57 ` Jeff Layton
  2024-07-19 14:08 ` Chuck Lever
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-07-19 10:54 UTC (permalink / raw)
  To: Chuck Lever, Jeff Layton, Trond Myklebust, Anna Schumaker
  Cc: Arnd Bergmann, Neil Brown, Olga Kornievskaia, Dai Ngo,
	Tom Talpey, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Benjamin Coddington, Josef Bacik, linux-nfs, netdev,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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>
---
 net/sunrpc/svc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index e03f14024e47..88a59cfa5583 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -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,
-- 
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-19 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-19 10:54 [PATCH] sunrpc: avoid -Wformat-security warning Arnd Bergmann
2024-07-19 11:57 ` Jeff Layton
2024-07-19 14:08 ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®