[PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg

Jack Wang posted 19 patches 3 years, 7 months ago
[PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
Posted by Jack Wang 3 years, 7 months ago
ib_dma_map_sg return 0 on error.

Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/nvme/host/rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 3100643be299..d70bccbcba3e 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1551,7 +1551,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq,
 
 	*count = ib_dma_map_sg(ibdev, req->data_sgl.sg_table.sgl,
 			       req->data_sgl.nents, rq_dma_dir(rq));
-	if (unlikely(*count <= 0)) {
+	if (unlikely(!*count)) {
 		ret = -EIO;
 		goto out_free_table;
 	}
@@ -1574,7 +1574,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq,
 					  req->metadata_sgl->sg_table.sgl,
 					  req->metadata_sgl->nents,
 					  rq_dma_dir(rq));
-		if (unlikely(*pi_count <= 0)) {
+		if (unlikely(!*pi_count)) {
 			ret = -EIO;
 			goto out_free_pi_table;
 		}
-- 
2.34.1
Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
Posted by Christoph Hellwig 3 years, 7 months ago
Please don't send me just two random patches out of a series, as I
have no way to review them.  If the patches are independent, send them
independently and if they depend on common prep work send the entire
series to everyone.
Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
Posted by Jinpu Wang 3 years, 7 months ago
On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Please don't send me just two random patches out of a series, as I
> have no way to review them.  If the patches are independent, send them
> independently and if they depend on common prep work send the entire
> series to everyone.
Hi Christoph,

As mentioned in the cover letter, the bugfixes are all independent,
for each of the drivers.

I will wait a bit to see if there is other comments,  resend as you
suggested later.

Thx!
Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
Posted by Christoph Hellwig 3 years, 7 months ago
On Mon, Aug 22, 2022 at 07:12:23AM +0200, Jinpu Wang wrote:
> On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > Please don't send me just two random patches out of a series, as I
> > have no way to review them.  If the patches are independent, send them
> > independently and if they depend on common prep work send the entire
> > series to everyone.
> Hi Christoph,
> 
> As mentioned in the cover letter, the bugfixes are all independent,
> for each of the drivers.

I still haven't seen the cover letter as it was never sent to me.
But if patches are independent please send a series per subsystem
as that makes that very clear.
Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
Posted by Jinpu Wang 3 years, 7 months ago
On Mon, Aug 22, 2022 at 8:25 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Mon, Aug 22, 2022 at 07:12:23AM +0200, Jinpu Wang wrote:
> > On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
> > >
> > > Please don't send me just two random patches out of a series, as I
> > > have no way to review them.  If the patches are independent, send them
> > > independently and if they depend on common prep work send the entire
> > > series to everyone.
> > Hi Christoph,
> >
> > As mentioned in the cover letter, the bugfixes are all independent,
> > for each of the drivers.
>
> I still haven't seen the cover letter as it was never sent to me.
> But if patches are independent please send a series per subsystem
> as that makes that very clear.
Thanks for the hint, this definitely helps the subsystem maintainer to
get a clear background.
I'll do it in the future.