[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210128141728.639030-1-colin.king@canonical.com>
Date: Thu, 28 Jan 2021 14:17:28 +0000
From: Colin King <colin.king@...onical.com>
To: Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Tian Tao <tiantao6@...ilicon.com>,
Stephen Rothwell <sfr@...b.auug.org.au>, linux-mm@...ck.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] mm/zswap: fix potential uninitialized pointer read on tmp
From: Colin Ian King <colin.king@...onical.com>
In the case where zpool_can_sleep_mapped(pool) returns 0
then tmp is not allocated and tmp is then an uninitialized
pointer. Later if entry is null, tmp is freed, hence free'ing
an uninitialized pointer. Fix this by ensuring tmp is initialized
to NULL.
Addresses-Coverity: ("Uninitialized pointer read")
Fixes: 908aa806dba0 ("mm/zswap: fix potential memory leak")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
mm/zswap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 8d1381b1178d..578d9f256920 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -935,7 +935,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
struct scatterlist input, output;
struct crypto_acomp_ctx *acomp_ctx;
- u8 *src, *tmp;
+ u8 *src, *tmp = NULL;
unsigned int dlen;
int ret;
struct writeback_control wbc = {
--
2.29.2
Powered by blists - more mailing lists