LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] IB/core: Fix wrong return value in _ib_modify_qp()
@ 2020-08-02 11:15 Tianjia Zhang
  2020-08-06 18:13 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Tianjia Zhang @ 2020-08-02 11:15 UTC (permalink / raw)
  To: dledford, jgg, leon, parav, maorg, maxg, monis, chuck.lever
  Cc: linux-rdma, linux-kernel, tianjia.zhang

On an error exit path, a negative error code should be returned
instead of a positive return value.

Fixes: 7a5c938b9ed09 ("IB/core: Check for rdma_protocol_ib only after validating port_num")
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 drivers/infiniband/core/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 53d6505c0c7b..f369f0a19e85 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1712,7 +1712,7 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
 		if (!(rdma_protocol_ib(qp->device,
 				       attr->alt_ah_attr.port_num) &&
 		      rdma_protocol_ib(qp->device, port))) {
-			ret = EINVAL;
+			ret = -EINVAL;
 			goto out;
 		}
 	}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] IB/core: Fix wrong return value in _ib_modify_qp()
  2020-08-02 11:15 [PATCH] IB/core: Fix wrong return value in _ib_modify_qp() Tianjia Zhang
@ 2020-08-06 18:13 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-08-06 18:13 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: dledford, leon, parav, maorg, maxg, monis, chuck.lever,
	linux-rdma, linux-kernel, tianjia.zhang

On Sun, Aug 02, 2020 at 07:15:42PM +0800, Tianjia Zhang wrote:
> On an error exit path, a negative error code should be returned
> instead of a positive return value.
> 
> Fixes: 7a5c938b9ed09 ("IB/core: Check for rdma_protocol_ib only after validating port_num")
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  drivers/infiniband/core/verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 53d6505c0c7b..f369f0a19e85 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -1712,7 +1712,7 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
>  		if (!(rdma_protocol_ib(qp->device,
>  				       attr->alt_ah_attr.port_num) &&
>  		      rdma_protocol_ib(qp->device, port))) {
> -			ret = EINVAL;
> +			ret = -EINVAL;
>  			goto out;
>  		}
>  	}

This was already fixed here:

commit 47fda651d5af2506deac57d54887cf55ce26e244
Author: Li Heng <liheng40@huawei.com>
Date:   Sat Jul 25 10:56:27 2020 +0800

    RDMA/core: Fix return error value in _ib_modify_qp() to negative
    
    The error codes in _ib_modify_qp() are supposed to be negative errno.
    
    Fixes: 7a5c938b9ed0 ("IB/core: Check for rdma_protocol_ib only after validating port_num")
    Link: https://lore.kernel.org/r/1595645787-20375-1-git-send-email-liheng40@huawei.com
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Signed-off-by: Li Heng <liheng40@huawei.com>
    Reviewed-by: Parav Pandit <parav@mellanox.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Thanks,
Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 11:15 [PATCH] IB/core: Fix wrong return value in _ib_modify_qp() Tianjia Zhang
2020-08-06 18:13 ` Jason Gunthorpe

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git