2020-07-25 02:55:35

by Li Heng

[permalink] [raw]
Subject: [PATCH] RDMA/core: fix return error value to negative

Fixes: 8d9ec9addd6c (IB/core: Add a sgid_attr pointer to struct rdma_ah_attr)
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Li Heng <[email protected]>
---
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 53d6505c..f369f0a 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.7.4


2020-07-27 11:06:02

by Parav Pandit

[permalink] [raw]
Subject: RE: [PATCH] RDMA/core: fix return error value to negative

> From: [email protected] <[email protected]>
> On Behalf Of Li Heng
> Sent: Saturday, July 25, 2020 8:26 AM
>
> Fixes: 8d9ec9addd6c (IB/core: Add a sgid_attr pointer to struct rdma_ah_attr)
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Li Heng <[email protected]>
> ---
> 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 53d6505c..f369f0a 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.7.4

With below corrected fixes tag,

Fixes: 7a5c938b9ed0 ("IB/core: Check for rdma_protocol_ib only after validating port_num")
Reviewed-by: Parav Pandit <[email protected]>

2020-07-27 18:49:34

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH] RDMA/core: fix return error value to negative

On Sat, Jul 25, 2020 at 10:56:27AM +0800, Li Heng wrote:
> Fixes: 8d9ec9addd6c (IB/core: Add a sgid_attr pointer to struct rdma_ah_attr)
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Li Heng <[email protected]>
> Reviewed-by: Parav Pandit <[email protected]>
> ---
> drivers/infiniband/core/verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason