[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <F7C31145-1846-4DD3-8140-79E3D8249545@intel.com>
Date: Fri, 25 Nov 2016 23:16:48 +0000
From: "Dilger, Andreas" <andreas.dilger@...el.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: "Drokin, Oleg" <oleg.drokin@...el.com>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
Sebastien Buisson <sebastien.buisson@...l.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
Vitaly Fertman <vitaly_fertman@...atex.com>,
frank zago <fzago@...y.com>,
"Shehata, Amir" <amir.shehata@...el.com>,
"lustre-devel@...ts.lustre.org" <lustre-devel@...ts.lustre.org>
Subject: Re: [lustre-devel] [patch] staging: lustre/ptlrpc: small leak on
allocation failure
On Nov 24, 2016, at 04:12, Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> We should free "desc" before returning NULL.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Reviewed-by: Andreas Dilger <andreas.dilger@...el.com>
> diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
> index ac959ef..8047413 100644
> --- a/drivers/staging/lustre/lustre/ptlrpc/client.c
> +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
> @@ -128,12 +128,12 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
> GET_KIOV(desc) = kcalloc(nfrags, sizeof(*GET_KIOV(desc)),
> GFP_NOFS);
> if (!GET_KIOV(desc))
> - goto out;
> + goto free_desc;
> } else {
> GET_KVEC(desc) = kcalloc(nfrags, sizeof(*GET_KVEC(desc)),
> GFP_NOFS);
> if (!GET_KVEC(desc))
> - goto out;
> + goto free_desc;
> }
>
> spin_lock_init(&desc->bd_lock);
> @@ -154,7 +154,8 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
> LNetInvalidateHandle(&desc->bd_mds[i]);
>
> return desc;
> -out:
> +free_desc:
> + kfree(desc);
> return NULL;
> }
>
> _______________________________________________
> lustre-devel mailing list
> lustre-devel@...ts.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Powered by blists - more mailing lists