* ubi: fastmap: use kmem_cache_free to deallocate memory
@ 2017-10-29 12:40 Pan Bian
2017-10-30 8:28 ` Boris Brezillon
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-10-29 12:40 UTC (permalink / raw)
To: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
Brian Norris, Boris Brezillon, Marek Vasut, Cyrille Pitchen
Cc: linux-mtd, linux-kernel, Pan Bian
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>
---
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;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: ubi: fastmap: use kmem_cache_free to deallocate memory
2017-10-29 12:40 ubi: fastmap: use kmem_cache_free to deallocate memory Pan Bian
@ 2017-10-30 8:28 ` Boris Brezillon
0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-10-30 8:28 UTC (permalink / raw)
To: Pan Bian
Cc: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
Brian Norris, Marek Vasut, Cyrille Pitchen, linux-mtd,
linux-kernel
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-30 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-29 12:40 ubi: fastmap: use kmem_cache_free to deallocate memory Pan Bian
2017-10-30 8:28 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox