[PATCH 2/2] nvme: use driver pdu command for passthrough
Keith Busch
kbusch at kernel.org
Wed Mar 17 14:06:53 GMT 2021
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 at 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.
More information about the Linux-nvme
mailing list