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

Christoph Hellwig hch at lst.de
Mon Sep 4 23:48:46 PDT 2023


> +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?



More information about the Linux-nvme mailing list