From: Arnd Bergmann <arnd@arndb.de> To: linux-kernel@vger.kernel.org, James Smart <james.smart@broadcom.com>, Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, Israel Rukshin <israelr@mellanox.com>, Max Gurtovoy <maxg@mellanox.com> Cc: Arnd Bergmann <arnd@arndb.de>, Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.de>, linux-nvme@lists.infradead.org Subject: [PATCH 15/15] nvme: avoid gcc-10 zero-length-bounds warning Date: Thu, 30 Apr 2020 23:30:57 +0200 [thread overview] Message-ID: <20200430213101.135134-16-arnd@arndb.de> (raw) In-Reply-To: <20200430213101.135134-1-arnd@arndb.de> When CONFIG_ARCH_NO_SG_CHAIN is set, op->sgl[0] cannot be dereferenced, as gcc-10 now points out: drivers/nvme/host/fc.c: In function 'nvme_fc_init_request': drivers/nvme/host/fc.c:1774:29: warning: array subscript 0 is outside the bounds of an interior zero-length array 'struct scatterlist[0]' [-Wzero-length-bounds] 1774 | op->op.fcp_req.first_sgl = &op->sgl[0]; | ^~~~~~~~~~~ drivers/nvme/host/fc.c:98:21: note: while referencing 'sgl' 98 | struct scatterlist sgl[NVME_INLINE_SG_CNT]; | ^~~ I don't know if this is a legitimate warning or a false-positive. If this is just a false alarm, the warning is easily suppressed by interpreting the array as a pointer. Fixes: b1ae1a238900 ("nvme-fc: Avoid preallocating big SGL for data") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 887537d1243f..b7ecda48d597 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1771,7 +1771,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); if (res) return res; - op->op.fcp_req.first_sgl = &op->sgl[0]; + op->op.fcp_req.first_sgl = op->sgl; op->op.fcp_req.private = &op->priv[0]; nvme_req(rq)->ctrl = &ctrl->ctrl; return res; -- 2.26.0
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de> To: linux-kernel@vger.kernel.org, James Smart <james.smart@broadcom.com>, Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, Israel Rukshin <israelr@mellanox.com>, Max Gurtovoy <maxg@mellanox.com> Cc: linux-nvme@lists.infradead.org, Hannes Reinecke <hare@suse.de>, Arnd Bergmann <arnd@arndb.de>, Ming Lei <ming.lei@redhat.com> Subject: [PATCH 15/15] nvme: avoid gcc-10 zero-length-bounds warning Date: Thu, 30 Apr 2020 23:30:57 +0200 [thread overview] Message-ID: <20200430213101.135134-16-arnd@arndb.de> (raw) In-Reply-To: <20200430213101.135134-1-arnd@arndb.de> When CONFIG_ARCH_NO_SG_CHAIN is set, op->sgl[0] cannot be dereferenced, as gcc-10 now points out: drivers/nvme/host/fc.c: In function 'nvme_fc_init_request': drivers/nvme/host/fc.c:1774:29: warning: array subscript 0 is outside the bounds of an interior zero-length array 'struct scatterlist[0]' [-Wzero-length-bounds] 1774 | op->op.fcp_req.first_sgl = &op->sgl[0]; | ^~~~~~~~~~~ drivers/nvme/host/fc.c:98:21: note: while referencing 'sgl' 98 | struct scatterlist sgl[NVME_INLINE_SG_CNT]; | ^~~ I don't know if this is a legitimate warning or a false-positive. If this is just a false alarm, the warning is easily suppressed by interpreting the array as a pointer. Fixes: b1ae1a238900 ("nvme-fc: Avoid preallocating big SGL for data") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 887537d1243f..b7ecda48d597 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1771,7 +1771,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); if (res) return res; - op->op.fcp_req.first_sgl = &op->sgl[0]; + op->op.fcp_req.first_sgl = op->sgl; op->op.fcp_req.private = &op->priv[0]; nvme_req(rq)->ctrl = &ctrl->ctrl; return res; -- 2.26.0 _______________________________________________ linux-nvme mailing list linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-04-30 21:34 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-30 21:30 [PATCH 00/15] gcc-10 warning fixes Arnd Bergmann 2020-04-30 21:30 ` Arnd Bergmann 2020-04-30 21:30 ` Arnd Bergmann 2020-04-30 21:30 ` [PATCH 01/15] crypto - Avoid free() namespace collision Arnd Bergmann 2020-05-08 6:06 ` Herbert Xu 2020-04-30 21:30 ` [PATCH 02/15] iwlwifi: mvm: fix gcc-10 zero-length-bounds warning Arnd Bergmann 2020-06-10 12:18 ` Luciano Coelho 2020-04-30 21:30 ` [PATCH 03/15] mwifiex: avoid -Wstringop-overflow warning Arnd Bergmann 2020-05-06 8:43 ` Kalle Valo 2020-04-30 21:30 ` [PATCH 04/15] ath10k: fix gcc-10 zero-length-bounds warnings Arnd Bergmann 2020-04-30 21:30 ` Arnd Bergmann 2020-04-30 21:45 ` Gustavo A. R. Silva 2020-04-30 21:45 ` Gustavo A. R. Silva 2020-04-30 21:44 ` Arnd Bergmann 2020-04-30 21:44 ` Arnd Bergmann 2020-05-04 11:54 ` Kalle Valo 2020-05-04 11:54 ` Kalle Valo 2020-05-04 16:09 ` Gustavo A. R. Silva 2020-05-04 16:09 ` Gustavo A. R. Silva 2020-05-05 4:56 ` Kalle Valo 2020-05-05 4:56 ` Kalle Valo 2020-04-30 21:30 ` [PATCH 05/15] bpf: avoid gcc-10 stringop-overflow warning Arnd Bergmann 2020-05-04 21:06 ` Daniel Borkmann 2020-04-30 21:30 ` [PATCH 06/15] netfilter: conntrack: avoid gcc-10 zero-length-bounds warning Arnd Bergmann 2020-05-10 21:48 ` Pablo Neira Ayuso 2020-04-30 21:30 ` [PATCH 07/15] drop_monitor: work around gcc-10 stringop-overflow warning Arnd Bergmann 2020-05-01 11:28 ` Neil Horman 2020-04-30 21:30 ` [PATCH 08/15] usb: ehci: avoid gcc-10 zero-length-bounds warning Arnd Bergmann 2020-05-01 2:42 ` Alan Stern 2020-05-01 20:06 ` Arnd Bergmann 2020-05-01 20:10 ` Alan Stern 2020-04-30 21:30 ` [PATCH 09/15] udf: avoid gcc-10 zero-length-bounds warnings Arnd Bergmann 2020-04-30 21:54 ` Pali Rohár 2020-05-01 20:30 ` Arnd Bergmann 2020-05-01 20:48 ` Jan Kara 2020-05-01 20:57 ` Pali Rohár 2020-04-30 21:30 ` [PATCH 10/15] hpfs: avoid gcc-10 zero-length-bounds warning Arnd Bergmann 2020-04-30 21:30 ` [PATCH 11/15] omfs: avoid gcc-10 stringop-overflow warning Arnd Bergmann 2020-04-30 21:30 ` [PATCH 12/15] media: s5k5baf: avoid gcc-10 zero-length-bounds warning Arnd Bergmann 2020-04-30 21:46 ` Gustavo A. R. Silva 2020-04-30 21:30 ` [PATCH 13/15] scsi: sas: " Arnd Bergmann 2020-05-01 7:47 ` John Garry 2020-05-01 7:54 ` Arnd Bergmann 2020-05-01 14:53 ` James Bottomley 2020-05-01 17:36 ` Arnd Bergmann 2020-04-30 21:30 ` [PATCH 14/15] isci: " Arnd Bergmann 2020-04-30 21:30 ` Arnd Bergmann [this message] 2020-04-30 21:30 ` [PATCH 15/15] nvme: " Arnd Bergmann 2020-05-01 7:32 ` Christoph Hellwig 2020-05-01 7:32 ` Christoph Hellwig
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=20200430213101.135134-16-arnd@arndb.de \ --to=arnd@arndb.de \ --cc=axboe@fb.com \ --cc=hare@suse.de \ --cc=hch@lst.de \ --cc=israelr@mellanox.com \ --cc=james.smart@broadcom.com \ --cc=kbusch@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=maxg@mellanox.com \ --cc=ming.lei@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.