public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Zhu Yanjun <yanjunz@mellanox.com>,
	Doug Ledford <dledford@redhat.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/rxe: check for error
Date: Fri, 24 Apr 2020 15:30:56 -0300	[thread overview]
Message-ID: <20200424183056.GA17877@ziepe.ca> (raw)
In-Reply-To: <20200423104813.20484-1-sudipm.mukherjee@gmail.com>

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@gmail.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

      parent reply	other threads:[~2020-04-24 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 10:48 [PATCH] RDMA/rxe: check for error Sudip Mukherjee
2020-04-24  1:17 ` Yanjun Zhu
2020-04-24 18:30 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424183056.GA17877@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=yanjunz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox