* [PATCH] EDAC: fix dev_set_name() format string
@ 2025-03-04 14:35 Arnd Bergmann
2025-03-05 22:51 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-03-04 14:35 UTC (permalink / raw)
To: Borislav Petkov, Tony Luck, Fan Ni, Jonathan Cameron, Shiju Jose
Cc: Arnd Bergmann, James Morse, Mauro Carvalho Chehab, Robert Richter,
Jiri Slaby (SUSE), linux-edac, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Passing a variable string as the format to dev_set_name() causes a W=1 warning:
drivers/edac/edac_device.c:736:9: error: format not a string literal and no format arguments [-Werror=format-security]
736 | ret = dev_set_name(&ctx->dev, name);
| ^~~
Use a literal "%s" instead so the name can be the argument.
Fixes: db99ea5f2c03 ("EDAC: Add support for EDAC device features control")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/edac/edac_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 16611515ab34..0734909b08a4 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -733,7 +733,7 @@ int edac_dev_register(struct device *parent, char *name,
ctx->private = private;
dev_set_drvdata(&ctx->dev, ctx);
- ret = dev_set_name(&ctx->dev, name);
+ ret = dev_set_name(&ctx->dev, "%s", name);
if (ret)
goto data_mem_free;
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] EDAC: fix dev_set_name() format string
2025-03-04 14:35 [PATCH] EDAC: fix dev_set_name() format string Arnd Bergmann
@ 2025-03-05 22:51 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2025-03-05 22:51 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Tony Luck, Fan Ni, Jonathan Cameron, Shiju Jose, Arnd Bergmann,
James Morse, Mauro Carvalho Chehab, Robert Richter,
Jiri Slaby (SUSE), linux-edac, linux-kernel
On Tue, Mar 04, 2025 at 03:35:58PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Passing a variable string as the format to dev_set_name() causes a W=1 warning:
>
> drivers/edac/edac_device.c:736:9: error: format not a string literal and no format arguments [-Werror=format-security]
> 736 | ret = dev_set_name(&ctx->dev, name);
> | ^~~
>
> Use a literal "%s" instead so the name can be the argument.
>
> Fixes: db99ea5f2c03 ("EDAC: Add support for EDAC device features control")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/edac/edac_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-05 22:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 14:35 [PATCH] EDAC: fix dev_set_name() format string Arnd Bergmann
2025-03-05 22:51 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox