firmware: arm_scmi: Avoid non-constant printk format strings
PATCH 1/1 firmware: arm_scmi: Avoid non-constant printk format strings
From: Arnd Bergmann <[email protected]>
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.
--- drivers/firmware/arm_scmi/driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/arm_scmi/driver.c +2 -2
@@ -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)
Signature · 1 line
2.39.2
Sudeep Holla
AppliedQuoted 11 lines · Arnd Bergmann
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 | returndev_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