[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200424183056.GA17877@ziepe.ca>
Date: Fri, 24 Apr 2020 15:30:56 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc: Zhu Yanjun <yanjunz@...lanox.com>,
Doug Ledford <dledford@...hat.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org
Subject: Re: [PATCH] RDMA/rxe: check for error
On Thu, Apr 23, 2020 at 11:48:13AM +0100, Sudip Mukherjee wrote:
> rxe_create_mmap_info() returns either NULL or an error value in ERR_PTR
> and we only checked for NULL after return. We should be using
> IS_ERR_OR_NULL to check for both.
>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
> drivers/infiniband/sw/rxe/rxe_queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c
> index ff92704de32f..ef438ce4fcfa 100644
> +++ b/drivers/infiniband/sw/rxe/rxe_queue.c
> @@ -45,7 +45,7 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,
>
> if (outbuf) {
> ip = rxe_create_mmap_info(rxe, buf_size, udata, buf);
> - if (!ip)
> + if (IS_ERR_OR_NULL(ip))
> goto err1;
Same comment as for the rvt patch - do not use IS_ERR_OR_NULL. If a
function uses the ERR_PTR stuff then it should not return NULL. Fix
rxe_create_mmap_info and check all call sites
Jason
Powered by blists - more mailing lists