public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings
@ 2024-04-03 11:10 Arnd Bergmann
  2024-04-04 14:12 ` Sudeep Holla
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-04-03 11:10 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi
  Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Nikunj Kela, linux-arm-kernel, linux-kernel, llvm

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings
  2024-04-03 11:10 [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings Arnd Bergmann
@ 2024-04-04 14:12 ` Sudeep Holla
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2024-04-04 14:12 UTC (permalink / raw)
  To: Cristian Marussi, Arnd Bergmann
  Cc: Sudeep Holla, Arnd Bergmann, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Nikunj Kela, linux-arm-kernel,
	linux-kernel, llvm

On Wed, 03 Apr 2024 13:10:24 +0200, Arnd Bergmann wrote:
> 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);
>
> [...]

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] firmware: arm_scmi: Avoid non-constant printk format strings
      https://git.kernel.org/sudeep.holla/c/495667d49c50
--
Regards,
Sudeep


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-04 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 11:10 [PATCH] firmware: arm_scmi: Avoid non-constant printk format strings Arnd Bergmann
2024-04-04 14:12 ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox