Skip to content

Commit e428271

Browse files
author
Mete Durlu
committed
s390: ism: Pass string literal as format argument of dev_set_name()
JIRA: https://issues.redhat.com/browse/RHEL-99989 commit 199561a Author: Simon Horman <horms@kernel.org> Date: Thu Apr 17 11:28:23 2025 +0100 s390: ism: Pass string literal as format argument of dev_set_name() GCC 14.2.0 reports that passing a non-string literal as the format argument of dev_set_name() is potentially insecure. drivers/s390/net/ism_drv.c: In function 'ism_probe': drivers/s390/net/ism_drv.c:615:2: warning: format not a string literal and no format arguments [-Wformat-security] 615 | dev_set_name(&ism->dev, dev_name(&pdev->dev)); | ^~~~~~~~~~~~ It seems to me that as pdev is a PCIE device then the dev_name call above should always return the device's BDF, e.g. 00:12.0. That this should not contain format escape sequences. And thus the current usage is safe. But, it seems better to be safe than sorry. And, as a bonus, compiler output becomes less verbose by addressing this issue. Compile tested only. No functional change intended. Signed-off-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250417-ism-str-fmt-v1-1-9818b029874d@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com> Signed-off-by: Mete Durlu <mdurlu@redhat.com>
1 parent bd2c46b commit e428271

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/s390/net/ism_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
615615
ism->dev.parent = &pdev->dev;
616616
ism->dev.release = ism_dev_release;
617617
device_initialize(&ism->dev);
618-
dev_set_name(&ism->dev, dev_name(&pdev->dev));
618+
dev_set_name(&ism->dev, "%s", dev_name(&pdev->dev));
619619
ret = device_add(&ism->dev);
620620
if (ret)
621621
goto err_dev;

0 commit comments

Comments
 (0)