public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Fan Ni <fan.ni@samsung.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Shiju Jose <shiju.jose@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>, James Morse <james.morse@arm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Robert Richter <rric@kernel.org>,
	"Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] EDAC: fix dev_set_name() format string
Date: Tue,  4 Mar 2025 15:35:58 +0100	[thread overview]
Message-ID: <20250304143603.995820-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2025-03-04 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 14:35 Arnd Bergmann [this message]
2025-03-05 22:51 ` [PATCH] EDAC: fix dev_set_name() format string Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250304143603.995820-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=fan.ni@samsung.com \
    --cc=james.morse@arm.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=shiju.jose@huawei.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox