[PATCH] nvme: work around -Wformat-security warning

Damien Le Moal dlemoal at kernel.org
Wed Sep 16 20:40:51 PDT 2026


On 2026/09/16 18:44, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd at arndb.de>
> 
> Passing a string variable into dev_set_name() causes a warning
> when building with -Wformat-security enabled:
> 
> drivers/nvme/host/core.c: In function 'nvme_cdev_add':
> drivers/nvme/host/core.c:3911:9: error: format not a string literal and no format arguments [-Werror=format-security]
>  3911 |         ret = dev_set_name(cdev_device, name);
> 
> Remove the temporary strings and let dev_set_name() do the
> same thing internally.
> 
> Fixes: 26acdaa357cd ("nvme: fix crash and memory leak during invalid cdev teardown")
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal at kernel.org>

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list