Re: [V3 1/4] nvmet: set right status on error in id-ns handler
From: Christoph Hellwig <hch@lst.de>
Date: 2021-01-13 18:34:57
From: Christoph Hellwig <hch@lst.de>
Date: 2021-01-13 18:34:57
On Tue, Jan 12, 2021 at 01:48:01PM -0800, Keith Busch wrote:
On Tue, Jan 12, 2021 at 01:14:07PM -0800, Chaitanya Kulkarni wrote:quoted
@@ -541,7 +543,9 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) id->nsattr |= (1 << 0); nvmet_put_namespace(ns); done: - status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); + if (nvmet_copy_to_sgl(req, 0, id, sizeof(*id)) && !status) + status = NVME_SC_SGL_INVALID_DATA | NVME_SC_DNR;If the status is already in error, you don't need to copy out the blank struct, right? Shouldn't this be like: if (!status) status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
Yes. _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme