]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
EDAC/device: Fix dev_set_name() format string
authorArnd Bergmann <arnd@arndb.de>
Tue, 4 Mar 2025 14:35:58 +0000 (15:35 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 5 Mar 2025 22:35:01 +0000 (23:35 +0100)
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>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20250304143603.995820-1-arnd@kernel.org
drivers/edac/edac_device.c

index 16611515ab348290d02f8bcc97192e7789b9e13f..0734909b08a4f61d60f636e799219454b5c94a90 100644 (file)
@@ -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;