mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Arnd Bergmann <arnd@kernel.org>, Keith Busch <kbusch@kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	Maurizio Lombardi <mlombard@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Hannes Reinecke <hare@kernel.org>,
	John Garry <john.g.garry@oracle.com>,
	"Martin K. Petersen" <mkp@kernel.org>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme: work around -Wformat-security warning
Date: Thu, 17 Sep 2026 09:44:51 +0530	[thread overview]
Message-ID: <1b36e312-222b-4052-8a8c-0583c908ea19@linux.ibm.com> (raw)
In-Reply-To: <20260916114533.237863-1-arnd@kernel.org>

On 9/16/26 5:14 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@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@arndb.de>

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.

Thanks,
--Nilay

  parent reply	other threads:[~2026-09-17  4:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 11:44 Arnd Bergmann
2026-09-17  3:40 ` Damien Le Moal
2026-09-17  4:14 ` Nilay Shroff [this message]
2026-09-17  5:59   ` Arnd Bergmann
2026-09-17  8:01 ` John Garry
2026-09-17  8:18 ` Nilay Shroff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b36e312-222b-4052-8a8c-0583c908ea19@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=john.g.garry@oracle.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mkp@kernel.org \
    --cc=mlombard@redhat.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®