linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Kanchan Joshi <joshiiitr@gmail.com>
Cc: linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>,
	Christoph Hellwig <hch@lst.de>,
	Kanchan Joshi <joshi.k@samsung.com>
Subject: Re: [PATCH 2/2] nvme: use driver pdu command for passthrough
Date: Wed, 17 Mar 2021 23:06:53 +0900	[thread overview]
Message-ID: <20210317140653.GA26641@redsun51.ssa.fujisawa.hgst.com> (raw)
In-Reply-To: <CA+1E3rKQ-275KmsUNC1d9XP1rK6uVHWKmptj7Hkb2BVeqZJqag@mail.gmail.com>

On Wed, Mar 17, 2021 at 03:16:59PM +0530, Kanchan Joshi wrote:
> On Tue, Mar 16, 2021 at 10:48 PM Keith Busch <kbusch@kernel.org> wrote:
> > @@ -595,7 +598,7 @@ static inline void nvme_init_request(struct request *req,
> >
> >         req->cmd_flags |= REQ_FAILFAST_DRIVER;
> >         nvme_clear_nvme_request(req);
> > -       nvme_req(req)->cmd = cmd;
> > +       memcpy(nvme_req(req)->cmd, cmd, sizeof(*cmd));
> >  }
> I am wondering if this memcpy() is fine. The "nvme_req(req)->cmd" is a
> pointer which may not have storage assigned to it?

The nvme drivers set it via blk_mq_op's .init_request(). This happens
before the request_queue is initialized, so the command pointer should
always be initialized before execution can reach this part of the code.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-03-17 14:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 17:06 [PATCH 1/2] nvme-pci: allocate nvme_command within driver pdu Keith Busch
2021-03-16 17:06 ` [PATCH 2/2] nvme: use driver pdu command for passthrough Keith Busch
2021-03-16 17:44   ` Sagi Grimberg
2021-03-16 18:08     ` Keith Busch
2021-03-17  6:47   ` Christoph Hellwig
2021-03-17  9:46   ` Kanchan Joshi
2021-03-17 14:06     ` Keith Busch [this message]
2021-03-16 17:44 ` [PATCH 1/2] nvme-pci: allocate nvme_command within driver pdu Sagi Grimberg
2021-03-16 18:02 ` Christoph Hellwig
2021-03-16 18:13   ` Keith Busch
2021-03-16 18:27     ` Sagi Grimberg
2021-03-16 18:34       ` Christoph Hellwig
2021-03-17  6:46 ` 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=20210317140653.GA26641@redsun51.ssa.fujisawa.hgst.com \
    --to=kbusch@kernel.org \
    --cc=hch@lst.de \
    --cc=joshi.k@samsung.com \
    --cc=joshiiitr@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).