Message ID | 20211013080645.GD6010@kili (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | RDMA/rdmavt: fix error code in rvt_create_qp() | expand |
On 10/13/21 4:06 AM, Dan Carpenter wrote: > Return negative -ENOMEM instead of positive ENOMEM. Returning a postive > value will cause an Oops because it becomes an ERR_PTR() in the > create_qp() function. > > Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory") > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- > drivers/infiniband/sw/rdmavt/qp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c > index 49bdd78ac664..3305f2744bfa 100644 > --- a/drivers/infiniband/sw/rdmavt/qp.c > +++ b/drivers/infiniband/sw/rdmavt/qp.c > @@ -1223,7 +1223,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr, > spin_lock(&rdi->n_qps_lock); > if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) { > spin_unlock(&rdi->n_qps_lock); > - ret = ENOMEM; > + ret = -ENOMEM; > goto bail_ip; > } > > Thanks Dan. Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
On Wed, Oct 13, 2021 at 11:06:45AM +0300, Dan Carpenter wrote: > Return negative -ENOMEM instead of positive ENOMEM. Returning a postive > value will cause an Oops because it becomes an ERR_PTR() in the > create_qp() function. > > Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory") > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> > --- > drivers/infiniband/sw/rdmavt/qp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to for-rc, thanks Jason
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index 49bdd78ac664..3305f2744bfa 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -1223,7 +1223,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr, spin_lock(&rdi->n_qps_lock); if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) { spin_unlock(&rdi->n_qps_lock); - ret = ENOMEM; + ret = -ENOMEM; goto bail_ip; }
Return negative -ENOMEM instead of positive ENOMEM. Returning a postive value will cause an Oops because it becomes an ERR_PTR() in the create_qp() function. Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/infiniband/sw/rdmavt/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)