Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dan Carpenter <error27@gmail.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Bob Pearson <rpearsonhpe@gmail.com>,
	linux-rdma@vger.kernel.org, Zhu Yanjun <zyjzyj2000@gmail.com>
Subject: Re: [PATCH rdma-next] RDMA/rxe: Clean kzalloc failure paths
Date: Wed, 29 Mar 2023 22:18:39 +0300	[thread overview]
Message-ID: <20230329191839.GI831478@unreal> (raw)
In-Reply-To: <88b57490-4260-42f6-88e0-ff8a3d30ce51@kili.mountain>

On Wed, Mar 29, 2023 at 09:44:09PM +0300, Dan Carpenter wrote:
> On Wed, Mar 29, 2023 at 09:14:01PM +0300, Leon Romanovsky wrote:
> > @@ -1287,11 +1279,8 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
> >  	}
> >  
> >  	mr = kzalloc(sizeof(*mr), GFP_KERNEL);
> > -	if (!mr) {
> > -		err = -ENOMEM;
> > -		rxe_dbg_mr(mr, "no memory for mr");
> > -		goto err_out;
> > -	}
> > +	if (!mr)
> > +		return ERR_PTR(-ENOMEM);
> >  
> >  	err = rxe_add_to_pool(&rxe->mr_pool, mr);
> >  	if (err) {
>         ^^^^^^^^^^
> If the rxe_add_to_pool() fails then it calls:
> 
> 	rxe_dbg_mr(mr, "unable to create mr, err = %d", err);
>                    ^^
> 
> "rm" is zeroed mem and not useful at this point.  Possibly in a later
> patch though.

I will delete that line when will apply the patch.

Thanks

> 
> regards,
> dan carpenter
> 

  reply	other threads:[~2023-03-29 19:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 18:14 [PATCH rdma-next] RDMA/rxe: Clean kzalloc failure paths Leon Romanovsky
2023-03-29 18:44 ` Dan Carpenter
2023-03-29 19:18   ` Leon Romanovsky [this message]
2023-03-29 19:57 ` Bob Pearson
2023-03-30  6:56 ` Leon Romanovsky

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=20230329191839.GI831478@unreal \
    --to=leon@kernel.org \
    --cc=error27@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=zyjzyj2000@gmail.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