IB/rdmavt: return proper error code
Subsystems (2)
PATCH 1/1 IB/rdmavt: return proper error code
The function rvt_create_mmap_info() can return either NULL or an error in ERR_PTR(). Check properly for both the error type and return the error code accordingly.
--- drivers/infiniband/sw/rdmavt/cq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rdmavt/cq.c +2 -2
@@ -248,8 +248,8 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,*/ if (udata && udata->outlen >=sizeof (__u64)) { cq->ip =rvt_create_mmap_info (rdi, sz, udata, u_wc); -if (!cq->ip) { - err = -ENOMEM ; +if (IS_ERR_OR_NULL (cq->ip)) { + err = cq->ip ?PTR_ERR (cq->ip) : -ENOMEM ; goto bail_wc; }
Signature · 1 line
2.11.0
Quoted 3 lines · Sudip Mukherjee
The function
rvt_create_mmap_info()can return either NULL or an error inERR_PTR(). Check properly for both the error type and return the error code accordingly.
Please fix rvt_create_mmap_info to always return ERR_PTR, never null on failure.
Thanks,
Jason
Quoted 11 lines · Jason Gunthorpe
Quoted 3 lines · Sudip Mukherjee
The function
rvt_create_mmap_info()can return either NULL or an error inERR_PTR(). Check properly for both the error type and return the error code accordingly.Please fix
rvt_create_mmap_infoto always returnERR_PTR, never null on failure.Thanks,
Jason
Yes, that is a better approach.
-Denny
Quoted 7 lines
Subject: Re: [PATCH] IB/rdmavt: return proper error code
Quoted 3 lines · Sudip Mukherjee
The function
rvt_create_mmap_info()can return either NULL or an error inERR_PTR(). Check properly for both the error type and return the error code accordingly.
Quoted 5 lines
Please fix
rvt_create_mmap_infoto always returnERR_PTR, never null on failure.Thanks,
Jason
I agree on the ERR_PTR return, but the patch is incomplete.
The original patch:
Broke all the call sites: cq.c, srq.c, and qp.c.
Mike
Quoted 13 lines · Mike
Quoted 7 lines
Subject: Re: [PATCH] IB/rdmavt: return proper error code
Quoted 3 lines · Sudip Mukherjee
The function
rvt_create_mmap_info()can return either NULL or an error inERR_PTR(). Check properly for both the error type and return the error code accordingly.Quoted 5 lines
Please fix
rvt_create_mmap_infoto always returnERR_PTR, never null on failure.Thanks,
Jason
Quoted 7 lines
I agree on the
ERR_PTRreturn, but the patch is incomplete.The original patch:
Fixes ff23dfa13457 ("IB: Pass only ib_udata in function prototypes")Broke all the call sites:
cq.c,srq.c, andqp.c.
Sure looks like it, someone make a patch..
Jason