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

Arnd Bergmann arnd at arndb.de
Wed Sep 16 22:59:34 PDT 2026


On Thu, Sep 17, 2026, at 06:14, Nilay Shroff wrote:
> On 9/16/26 5:14 PM, Arnd Bergmann wrote:
>
> The changes look good. However, I applied the patch and built
> drivers/nvme/ with -Wformat-security, and I still see a couple of
> additional warnings:
>
> $ make M=drivers/nvme/ KCFLAGS="-Wformat-security"
> make[1]: Entering directory 
> '/home/nilay/Development/linux-x86/drivers/nvme'
> [...]
> host/sysfs.c: In function ‘cntrltype_show’:
> host/sysfs.c:682:9: error: format not a string literal and no format 
> arguments [-Werror=format-security]
>    682 |         return sysfs_emit(buf, type[ctrl->cntrltype]);
>        |         ^~~~~~
> host/sysfs.c: In function ‘dctype_show’:
> host/sysfs.c:699:9: error: format not a string literal and no format 
> arguments [-Werror=format-security]
>    699 |         return sysfs_emit(buf, type[ctrl->dctype]);
>        |         ^~~~~~
>
> I think that if we're fixing -Wformat-security warnings in the NVMe
> driver, it would be useful to address above warnings as part of this
> patch as well.

Good point, I forgot to check for the patches I already had fixed
in my randconfig branch and only addressed the new one here. I'll
send a separate patch to fix the two instance above.

        Arnd



More information about the Linux-nvme mailing list