From: Joe Perches <joe@perches.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
James Smart <james.smart@broadcom.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmet-fc: use zero-sized array and struct_size() in kzalloc()
Date: Sat, 23 Feb 2019 12:05:50 -0800 [thread overview]
Message-ID: <a38ddf4132398ca7f1705fa377fb52a2b09a2801.camel@perches.com> (raw)
In-Reply-To: <20190223185108.GA6706@embeddedor>
On Sat, 2019-02-23 at 12:51 -0600, Gustavo A. R. Silva wrote:
> Update the code to use a zero-sized array instead of a pointer in
> structure nvmet_fc_tgt_queue and use struct_size() in kzalloc().
[]
> This code was detected with the help of Coccinelle.
Really?
Impressive script that found this one.
> diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
[]
> @@ -128,12 +128,12 @@ struct nvmet_fc_tgt_queue {
> struct nvmet_cq nvme_cq;
> struct nvmet_sq nvme_sq;
> struct nvmet_fc_tgt_assoc *assoc;
> - struct nvmet_fc_fcp_iod *fod; /* array of fcp_iods */
> struct list_head fod_list;
> struct list_head pending_cmd_list;
> struct list_head avail_defer_list;
> struct workqueue_struct *work_q;
> struct kref ref;
> + struct nvmet_fc_fcp_iod fod[]; /* array of fcp_iods */
> } __aligned(sizeof(unsigned long long));
Moving a pointer from the middle of a struct to
the end seems unusual for coccinelle.
next prev parent reply other threads:[~2019-02-23 20:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-23 18:51 Gustavo A. R. Silva
2019-02-23 20:05 ` Joe Perches [this message]
2019-02-23 20:28 ` Gustavo A. R. Silva
2019-02-24 1:34 ` Gustavo A. R. Silva
2019-03-08 13:27 ` Christoph Hellwig
2019-03-08 19:15 ` James Smart
2019-03-12 19:33 ` Christoph Hellwig
2019-03-12 19:47 ` Gustavo A. R. Silva
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=a38ddf4132398ca7f1705fa377fb52a2b09a2801.camel@perches.com \
--to=joe@perches.com \
--cc=gustavo@embeddedor.com \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--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®