Thread (3 messages) 3 messages, 3 authors, 2021-01-28

Re: [PATCH][next] mm/zswap: fix potential uninitialized pointer read on tmp

From: Vlastimil Babka <hidden>
Date: 2021-01-28 15:22:17
Also in: kernel-janitors, lkml

On 1/28/21 3:17 PM, Colin King wrote:
From: Colin Ian King <redacted>

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")
That's a linux-next hash, patch is in mmotm [1] *) You know what it means...

*) actually it's not there, yet it is in -next. What's going on?

[1]
https://ozlabs.org/~akpm/mmotm/broken-out/mm-zswap-fix-potential-memory-leak.patch
quoted hunk ↗ jump to hunk
Signed-off-by: Colin Ian King <redacted>
---
 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 = {
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help