ubi: fastmap: Use kmem_cache_free to deallocate memory
authorPan Bian <bianpan2016@163.com>
Sun, 29 Oct 2017 12:40:02 +0000 (20:40 +0800)
committerRichard Weinberger <richard@nod.at>
Wed, 17 Jan 2018 20:48:02 +0000 (21:48 +0100)
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>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/fastmap.c

index 5a832bc79b1be0032735d2b16ac6add4eb54d872..717db749808ab4bbdb4d94776c66c129096dd6ac 100644 (file)
@@ -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;