lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0bd7d8ff-dcc4-43a5-862f-52e23106565c@linux.dev>
Date: Fri, 14 Mar 2025 20:05:08 +0100
From: Zhu Yanjun <yanjun.zhu@...ux.dev>
To: Arnd Bergmann <arnd@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
 Leon Romanovsky <leon@...nel.org>, Yishai Hadas <yishaih@...dia.com>,
 Chiara Meiohas <cmeiohas@...dia.com>
Cc: Arnd Bergmann <arnd@...db.de>, linux-rdma@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] inifiniband: ucaps: avoid format-security warning


在 2025/3/14 16:57, Arnd Bergmann 写道:
> From: Arnd Bergmann <arnd@...db.de>
>
> Passing a non-constant 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 thet %s argument as suggested by gcc.
>
> Fixes: 61e51682816d ("RDMA/uverbs: Introduce UCAP (User CAPabilities) API")

This patch should be for linux-next. In the subject, linux-next should 
be added.

Except the above, I am fine with this commit.

Reviewed-by: Zhu Yanjun <yanjun.zhu@...ux.dev>

Zhu Yanjun

> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>   drivers/infiniband/core/ucaps.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/ucaps.c b/drivers/infiniband/core/ucaps.c
> index 6853c6d078f9..de5cb8bf0a61 100644
> --- a/drivers/infiniband/core/ucaps.c
> +++ b/drivers/infiniband/core/ucaps.c
> @@ -170,7 +170,7 @@ int ib_create_ucap(enum rdma_user_cap type)
>   	ucap->dev.class = &ucaps_class;
>   	ucap->dev.devt = MKDEV(MAJOR(ucaps_base_dev), type);
>   	ucap->dev.release = ucap_dev_release;
> -	ret = dev_set_name(&ucap->dev, ucap_names[type]);
> +	ret = dev_set_name(&ucap->dev, "%s", ucap_names[type]);
>   	if (ret)
>   		goto err_device;
>   

-- 
Best Regards,
Yanjun.Zhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ