All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] zram: fix memory freeing in zram_meta_alloc
@ 2015-11-08 15:32 Geliang Tang
  2015-11-08 15:32 ` [PATCH 2/2] zram: fix memory freeing in zram_bvec_read Geliang Tang
  2015-11-09  0:33 ` [PATCH 1/2] zram: fix memory freeing in zram_meta_alloc Sergey Senozhatsky
  0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2015-11-08 15:32 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta, Sergey Senozhatsky; +Cc: Geliang Tang, linux-kernel

When meta->table is NULL, there is no need to vfree it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/block/zram/zram_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 81a557c..197a7ad 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -511,7 +511,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
 	meta->table = vzalloc(num_pages * sizeof(*meta->table));
 	if (!meta->table) {
 		pr_err("Error allocating zram address table\n");
-		goto out_error;
+		goto out_free;
 	}
 
 	meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM);
@@ -524,6 +524,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
 
 out_error:
 	vfree(meta->table);
+out_free:
 	kfree(meta);
 	return NULL;
 }
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-09  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-08 15:32 [PATCH 1/2] zram: fix memory freeing in zram_meta_alloc Geliang Tang
2015-11-08 15:32 ` [PATCH 2/2] zram: fix memory freeing in zram_bvec_read Geliang Tang
2015-11-09  0:42   ` Sergey Senozhatsky
2015-11-09  0:33 ` [PATCH 1/2] zram: fix memory freeing in zram_meta_alloc Sergey Senozhatsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.