public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Pan Bian <bianpan2016@163.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: ubi: fastmap: use kmem_cache_free to deallocate memory
Date: Mon, 30 Oct 2017 09:28:24 +0100	[thread overview]
Message-ID: <20171030092824.464ea876@bbrezillon> (raw)
In-Reply-To: <1509280802-14620-1-git-send-email-bianpan2016@163.com>

On Sun, 29 Oct 2017 20:40:02 +0800
Pan Bian <bianpan2016@163.com> wrote:

> Memory allocated by kmem_cache_alloc() should not be deallocated with
> kfree(). Use kmem_cache_free() instead.
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Richard, maybe you can add:

Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
Cc: <stable@vger.kernel.org>

> ---
>  drivers/mtd/ubi/fastmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> index 5a832bc..717db749 100644
> --- a/drivers/mtd/ubi/fastmap.c
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -1063,7 +1063,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
>  		e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
>  		if (!e) {
>  			while (i--)
> -				kfree(fm->e[i]);
> +				kmem_cache_free(ubi_wl_entry_slab, fm->e[i]);
>  
>  			ret = -ENOMEM;
>  			goto free_hdr;

      reply	other threads:[~2017-10-30  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 12:40 ubi: fastmap: use kmem_cache_free to deallocate memory Pan Bian
2017-10-30  8:28 ` Boris Brezillon [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=20171030092824.464ea876@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=bianpan2016@163.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /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