* [PATCH] IB/rdmavt: return proper error code
@ 2020-04-23 12:04 Sudip Mukherjee
2020-04-23 14:09 ` Jason Gunthorpe
0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2020-04-23 12:04 UTC (permalink / raw)
To: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford, Jason Gunthorpe
Cc: linux-kernel, linux-rdma, Sudip Mukherjee
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.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/infiniband/sw/rdmavt/cq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c
index 5724cbbe38b1..326b1e6b362d 100644
--- a/drivers/infiniband/sw/rdmavt/cq.c
+++ b/drivers/infiniband/sw/rdmavt/cq.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/rdmavt: return proper error code
2020-04-23 12:04 [PATCH] IB/rdmavt: return proper error code Sudip Mukherjee
@ 2020-04-23 14:09 ` Jason Gunthorpe
2020-04-24 12:27 ` Dennis Dalessandro
2020-04-24 13:50 ` Marciniszyn, Mike
0 siblings, 2 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2020-04-23 14:09 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford, linux-kernel,
linux-rdma
On Thu, Apr 23, 2020 at 01:04:34PM +0100, Sudip Mukherjee wrote:
> 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.
Please fix rvt_create_mmap_info to always return ERR_PTR, never null
on failure.
Thanks,
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/rdmavt: return proper error code
2020-04-23 14:09 ` Jason Gunthorpe
@ 2020-04-24 12:27 ` Dennis Dalessandro
2020-04-24 13:50 ` Marciniszyn, Mike
1 sibling, 0 replies; 6+ messages in thread
From: Dennis Dalessandro @ 2020-04-24 12:27 UTC (permalink / raw)
To: Jason Gunthorpe, Sudip Mukherjee
Cc: Mike Marciniszyn, Doug Ledford, linux-kernel, linux-rdma
On 4/23/2020 10:09 AM, Jason Gunthorpe wrote:
> On Thu, Apr 23, 2020 at 01:04:34PM +0100, Sudip Mukherjee wrote:
>> 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.
>
> Please fix rvt_create_mmap_info to always return ERR_PTR, never null
> on failure.
>
> Thanks,
> Jason
>
Yes, that is a better approach.
-Denny
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] IB/rdmavt: return proper error code
2020-04-23 14:09 ` Jason Gunthorpe
2020-04-24 12:27 ` Dennis Dalessandro
@ 2020-04-24 13:50 ` Marciniszyn, Mike
2020-04-24 14:00 ` Jason Gunthorpe
1 sibling, 1 reply; 6+ messages in thread
From: Marciniszyn, Mike @ 2020-04-24 13:50 UTC (permalink / raw)
To: Jason Gunthorpe, Sudip Mukherjee
Cc: Dalessandro, Dennis, Doug Ledford, linux-kernel, linux-rdma
> Subject: Re: [PATCH] IB/rdmavt: return proper error code
>
> On Thu, Apr 23, 2020 at 01:04:34PM +0100, Sudip Mukherjee wrote:
> > 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.
>
> Please fix rvt_create_mmap_info to always return ERR_PTR, never null
> on failure.
>
> Thanks,
> Jason
I agree on the ERR_PTR return, 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, and qp.c.
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/rdmavt: return proper error code
2020-04-24 13:50 ` Marciniszyn, Mike
@ 2020-04-24 14:00 ` Jason Gunthorpe
0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2020-04-24 14:00 UTC (permalink / raw)
To: Marciniszyn, Mike
Cc: Sudip Mukherjee, Dalessandro, Dennis, Doug Ledford, linux-kernel,
linux-rdma
On Fri, Apr 24, 2020 at 01:50:22PM +0000, Marciniszyn, Mike wrote:
> > Subject: Re: [PATCH] IB/rdmavt: return proper error code
> >
> > On Thu, Apr 23, 2020 at 01:04:34PM +0100, Sudip Mukherjee wrote:
> > > 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.
> >
> > Please fix rvt_create_mmap_info to always return ERR_PTR, never null
> > on failure.
> >
> > Thanks,
> > Jason
>
> I agree on the ERR_PTR return, 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, and qp.c.
Sure looks like it, someone make a patch..
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/rdmavt: return proper error code
@ 2020-04-23 12:48 Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-04-23 12:48 UTC (permalink / raw)
To: Sudip Mukherjee, linux-rdma, Dennis Dalessandro, Doug Ledford,
Jason Gunthorpe, Mike Marciniszyn
Cc: linux-kernel
> 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.
How do you think about to add the tag “Fixes” because of adjustments
for the exception handling?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-24 14:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 12:04 [PATCH] IB/rdmavt: return proper error code Sudip Mukherjee
2020-04-23 14:09 ` Jason Gunthorpe
2020-04-24 12:27 ` Dennis Dalessandro
2020-04-24 13:50 ` Marciniszyn, Mike
2020-04-24 14:00 ` Jason Gunthorpe
2020-04-23 12:48 Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).