[RFC v1 1/4] nvmet-trace: avoid dereferencing pointer too early

Daniel Wagner dwagner at suse.de
Tue Sep 5 01:24:51 PDT 2023


On Tue, Sep 05, 2023 at 08:48:46AM +0200, Christoph Hellwig wrote:
> > +static inline u16 nvmet_req_to_ctrl_id(struct nvmet_req *req)
> >  {
> > -	return req->sq->ctrl;
> > +	if (!req->sq || !req->sq->ctrl)
> > +		return 0;
> > +	return req->sq->ctrl->cntlid;
> 
> Can you add a comment here why we have this check?

/*
 * The queue and controller pointer are not valid until an
 * association has been established.
 */

?



More information about the Linux-nvme mailing list