Skip to content

Commit ae04342

Browse files
arndbvinodkoul
authored andcommitted
dmaengine: avoid non-constant format string
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: 10b8e0f ("dmaengine: add channel device name to channel registration") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20240719102319.546622-1-arnd@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 39dc2a4 commit ae04342

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/dma/dmaengine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ static int __dma_async_device_channel_register(struct dma_device *device,
10701070
if (!name)
10711071
dev_set_name(&chan->dev->device, "dma%dchan%d", device->dev_id, chan->chan_id);
10721072
else
1073-
dev_set_name(&chan->dev->device, name);
1073+
dev_set_name(&chan->dev->device, "%s", name);
10741074
rc = device_register(&chan->dev->device);
10751075
if (rc)
10761076
goto err_out_ida;

0 commit comments

Comments
 (0)