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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ad5a485-6803-495a-98ee-9f7ad3e85946@intel.com>
Date: Fri, 19 Jul 2024 08:49:46 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Arnd Bergmann <arnd@...nel.org>, Vinod Koul <vkoul@...nel.org>,
 Amelie Delaunay <amelie.delaunay@...s.st.com>
Cc: Arnd Bergmann <arnd@...db.de>, Yajun Deng <yajun.deng@...ux.dev>,
 dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: avoid non-constant format string



On 7/19/24 3:23 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> Using an arbitrary string as a printf-style format can be a security
> problem if that string contains % characters, as the optionalal
> -Wformat-security flag points out:
> 
> drivers/dma/dmaengine.c: In function '__dma_async_device_channel_register':
> drivers/dma/dmaengine.c:1073:17: error: format not a string literal and no format arguments [-Werror=format-security]
>  1073 |                 dev_set_name(&chan->dev->device, name);
>       |                 ^~~~~~~~~~~~
> 
> Change this newly added instance to use "%s" as the format instead to
> pass the actual name.
> 
> Fixes: 10b8e0fd3f72 ("dmaengine: add channel device name to channel registration")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Reviewed-by: Dave Jiang <dave.jiang@...el.com>

> ---
>  drivers/dma/dmaengine.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index c380a4dda77a..c1357d7f3dc6 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -1070,7 +1070,7 @@ static int __dma_async_device_channel_register(struct dma_device *device,
>  	if (!name)
>  		dev_set_name(&chan->dev->device, "dma%dchan%d", device->dev_id, chan->chan_id);
>  	else
> -		dev_set_name(&chan->dev->device, name);
> +		dev_set_name(&chan->dev->device, "%s", name);
>  	rc = device_register(&chan->dev->device);
>  	if (rc)
>  		goto err_out_ida;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ