Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1479831 > unrolled thread

[PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl

Started bySalil Mehta <salil.mehta@huawei.com>
First post2016-09-09 12:20 +0200
Last post2016-09-20 19:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Salil Mehta <salil.mehta@huawei.com> - 2016-09-09 12:20 +0200
    Re: [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Leon Romanovsky <leon@kernel.org> - 2016-09-15 12:10 +0200
      RE: [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 19:00 +0200

#1479831 — [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl

FromSalil Mehta <salil.mehta@huawei.com>
Date2016-09-09 12:20 +0200
Subject[PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl
Message-ID<sfr4B-1xy-9@gated-at.bofh.it>
From: Lijun Ou <oulijun@huawei.com>

The pointer ctrl may be null, so we add check for it.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 5f76fc1..ea47ec4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -336,6 +336,12 @@ int hns_roce_v1_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 		}
 
 		ctrl = get_recv_wqe(hr_qp, ind);
+		if (unlikely(!ctrl)) {
+			dev_err(dev, "Get recv wqe failed!\n");
+			ret = -EINVAL;
+			*bad_wr = wr;
+			goto out;
+		}
 
 		roce_set_field(ctrl->rwqe_byte_12,
 			       RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M,
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1483944

FromLeon Romanovsky <leon@kernel.org>
Date2016-09-15 12:10 +0200
Message-ID<shBMe-5DZ-15@gated-at.bofh.it>
In reply to#1479831

[Multipart message — attachments visible in raw view] — view raw

On Fri, Sep 09, 2016 at 06:30:34PM +0800, Salil Mehta wrote:
> From: Lijun Ou <oulijun@huawei.com>
>
> The pointer ctrl may be null, so we add check for it.
>
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
> Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> index 5f76fc1..ea47ec4 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> @@ -336,6 +336,12 @@ int hns_roce_v1_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
>  		}
>
>  		ctrl = get_recv_wqe(hr_qp, ind);
> +		if (unlikely(!ctrl)) {

Yes, as you wrote, this check and patch are redundant too.

> +			dev_err(dev, "Get recv wqe failed!\n");
> +			ret = -EINVAL;
> +			*bad_wr = wr;
> +			goto out;
> +		}
>
>  		roce_set_field(ctrl->rwqe_byte_12,
>  			       RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M,
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1487524

FromSalil Mehta <salil.mehta@huawei.com>
Date2016-09-20 19:00 +0200
Message-ID<sjwyP-5zq-11@gated-at.bofh.it>
In reply to#1483944
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Leon Romanovsky
> Sent: Thursday, September 15, 2016 11:08 AM
> To: Salil Mehta
> Cc: dledford@redhat.com; Huwei (Xavier); oulijun; Zhuangyuzeng (Yisen);
> xuwei (O); mehta.salil.lnk@gmail.com; linux-rdma@vger.kernel.org;
> linux-kernel@vger.kernel.org; Linuxarm
> Subject: Re: [PATCH for-next 03/20] IB/hns: Add the check for pointer
> ctrl
> 
> On Fri, Sep 09, 2016 at 06:30:34PM +0800, Salil Mehta wrote:
> > From: Lijun Ou <oulijun@huawei.com>
> >
> > The pointer ctrl may be null, so we add check for it.
> >
> > Signed-off-by: Lijun Ou <oulijun@huawei.com>
> > Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
> > Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> > ---
> >  drivers/infiniband/hw/hns/hns_roce_hw_v1.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> > index 5f76fc1..ea47ec4 100644
> > --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> > +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> > @@ -336,6 +336,12 @@ int hns_roce_v1_post_recv(struct ib_qp *ibqp,
> struct ib_recv_wr *wr,
> >  		}
> >
> >  		ctrl = get_recv_wqe(hr_qp, ind);
> > +		if (unlikely(!ctrl)) {
> 
> Yes, as you wrote, this check and patch are redundant too.
I have dropped this patch in reworked V2 patch and introduced new patch
to remove the redundant code as well in get_recv_wqe() and get_send_wqe().

Thanks
Salil
> 
> > +			dev_err(dev, "Get recv wqe failed!\n");
> > +			ret = -EINVAL;
> > +			*bad_wr = wr;
> > +			goto out;
> > +		}
> >
> >  		roce_set_field(ctrl->rwqe_byte_12,
> >  			       RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M,
> > --
> > 1.7.9.5
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web