Skip to content

Commit

Permalink
EDAC/device: Fix dev_set_name() format string
Browse files Browse the repository at this point in the history
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: db99ea5 ("EDAC: Add support for EDAC device features control")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20250304143603.995820-1-arnd@kernel.org
  • Loading branch information
Arnd Bergmann authored and Borislav Petkov (AMD) committed Mar 5, 2025
1 parent 81e42fc commit 4947272
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/edac/edac_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4947272

Please sign in to comment.