[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <71cc3c69c9d50cf63a808285f524c8b5210ffaf2.1446996521.git.geliangtang@163.com>
Date: Sun, 8 Nov 2015 23:32:19 +0800
From: Geliang Tang <geliangtang@....com>
To: Minchan Kim <minchan@...nel.org>, Nitin Gupta <ngupta@...are.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Geliang Tang <geliangtang@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] zram: fix memory freeing in zram_bvec_read
When user_mem is NULL, there is no need to kunmap_atomic it.
Signed-off-by: Geliang Tang <geliangtang@....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 197a7ad..da7b348 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -625,7 +625,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
if (!uncmem) {
pr_err("Unable to allocate temp memory\n");
ret = -ENOMEM;
- goto out_cleanup;
+ goto out_free;
}
ret = zram_decompress_page(zram, uncmem, index);
@@ -641,6 +641,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
ret = 0;
out_cleanup:
kunmap_atomic(user_mem);
+out_free:
if (is_partial_io(bvec))
kfree(uncmem);
return ret;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists