Skip to contentSkip to conversation

platform/x86/intel/pmt/discovery: fix format string warning

PATCH In review Arnd Bergmann 2 participants 2 messages Jul 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86/intel/pmt/discovery: fix format string warning

From: Arnd Bergmann <[email protected]>

When -Wformat-security is enabled, this new code triggers it:

drivers/platform/x86/intel/pmt/discovery.c: In function 'pmt_features_discovery':
drivers/platform/x86/intel/pmt/discovery.c:505:36: error: format not a string literal and no format arguments [-Werror=format-security]
505 | pmt_feature_names[feature->id]);

Fixes d9a078809356 ("platform/x86/intel/pmt: Add PMT Discovery driver")
---
 drivers/platform/x86/intel/pmt/discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/pmt/discovery.c +1 -1
index 1a680a042a98..32713a194a55 100644
@@ -502,7 +502,7 @@ static int pmt_features_discovery(struct pmt_features_priv *priv,
 	}
 
 	ret = kobject_init_and_add(&feature->kobj, ktype, &priv->dev->kobj,
-				   pmt_feature_names[feature->id]);
+				   "%s", pmt_feature_names[feature->id]);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 8 lines · Arnd Bergmann

When -Wformat-security is enabled, this new code triggers it:

drivers/platform/x86/intel/pmt/discovery.c: In function 'pmt_features_discovery':
drivers/platform/x86/intel/pmt/discovery.c:505:36: error: format not a string literal and no format arguments [-Werror=format-security]
505 | pmt_feature_names[feature->id]);

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86/intel/pmt/discovery: fix format string warning

      commit: 6382c27389c266e90b31151a79d81fa6e122d2d6

--
i.