From: Arnd Bergmann <arnd@kernel.org>
To: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Nikunj Kela <quic_nkela@quicinc.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings
Date: Wed, 3 Apr 2024 13:10:24 +0200 [thread overview]
Message-ID: <20240403111040.3924658-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
A recent rework changed the constant format strings to a local variable,
which causes warnings from clang when -Wformat-security is enabled:
drivers/firmware/arm_scmi/driver.c: In function 'scmi_probe':
drivers/firmware/arm_scmi/driver.c:2936:25: error: format not a string literal and no format arguments [-Werror=format-security]
2936 | dev_err(dev, err_str);
| ^~~~~~~
drivers/firmware/arm_scmi/driver.c:2993:9: error: format not a string literal and no format arguments [-Werror=format-security]
2993 | return dev_err_probe(dev, ret, err_str);
Print these using an explicit "%s" string instead.
Fixes: 3a7d93d1f71b ("firmware: arm_scmi: Use dev_err_probe to bail out")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/firmware/arm_scmi/driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index d0091459a276..36e3eb50a8d4 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2933,7 +2933,7 @@ static int scmi_probe(struct platform_device *pdev)
if (ret) {
err_str = "unable to communicate with SCMI\n";
if (coex) {
- dev_err(dev, err_str);
+ dev_err(dev, "%s", err_str);
return 0;
}
goto notification_exit;
@@ -2990,7 +2990,7 @@ static int scmi_probe(struct platform_device *pdev)
clear_ida:
ida_free(&scmi_id, info->id);
- return dev_err_probe(dev, ret, err_str);
+ return dev_err_probe(dev, ret, "%s", err_str);
}
static void scmi_remove(struct platform_device *pdev)
--
2.39.2
next reply other threads:[~2024-04-03 11:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 11:10 Arnd Bergmann [this message]
2024-04-04 14:12 ` [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings Sudeep Holla
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=20240403111040.3924658-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=cristian.marussi@arm.com \
--cc=justinstitt@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=quic_nkela@quicinc.com \
--cc=sudeep.holla@arm.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