Skip to content

Commit 6d462a8

Browse files
committed
RDMA/ucaps: Avoid format-security warning
JIRA: https://issues.redhat.com/browse/RHEL-75591 commit 62dd71e Author: Arnd Bergmann <[email protected]> Date: Fri Mar 14 16:57:15 2025 +0100 RDMA/ucaps: Avoid format-security warning Passing a non-literal format string to dev_set_name causes a warning: drivers/infiniband/core/ucaps.c:173:33: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] 173 | ret = dev_set_name(&ucap->dev, ucap_names[type]); | ^~~~~~~~~~~~~~~~ drivers/infiniband/core/ucaps.c:173:33: note: treat the string as an argument to avoid this 173 | ret = dev_set_name(&ucap->dev, ucap_names[type]); | ^ | "%s", Turn the name into the %s argument as suggested by gcc. Fixes: 61e5168 ("RDMA/uverbs: Introduce UCAP (User CAPabilities) API") Link: https://patch.msgid.link/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Zhu Yanjun <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Kamal Heib <[email protected]>
1 parent e52e150 commit 6d462a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/core/ucaps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ int ib_create_ucap(enum rdma_user_cap type)
170170
ucap->dev.class = &ucaps_class;
171171
ucap->dev.devt = MKDEV(MAJOR(ucaps_base_dev), type);
172172
ucap->dev.release = ucap_dev_release;
173-
ret = dev_set_name(&ucap->dev, ucap_names[type]);
173+
ret = dev_set_name(&ucap->dev, "%s", ucap_names[type]);
174174
if (ret)
175175
goto err_device;
176176

0 commit comments

Comments
 (0)