mm/zswap: Add return value in zswap_frontswap_load
Subsystems (2)
PATCH 1/1 mm/zswap: Add return value in zswap_frontswap_load
Clang warns:
mm/zswap.c:1271:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!entry->length) {
^~~~~~~~~~~~~~
mm/zswap.c:1322:9: note: uninitialized use occurs here
return ret;
^~~
mm/zswap.c:1271:2: note: remove the 'if' if its condition is always
false
if (!entry->length) {
^~~~~~~~~~~~~~~~~~~~~
mm/zswap.c:1259:9: note: initialize the variable 'ret' to silence this
warning
int ret;
^
= 01 warning generated.
Prior to "mm/zswap: add the flag can_sleep_mapped", this path always returned 0. Restore that so we are not returning uninitialized memory.
---
Andrew, please fold this into
mm-zswap-add-the-flag-can_sleep_mapped.patch
mm/zswap.c | 1 + 1 file changed, 1 insertion(+)
mm/zswap.c +1 -0
@@ -1272,6 +1272,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset, dst =kmap_atomic (page);zswap_fill_page (dst, entry->value);kunmap_atomic (dst); + ret =0 ; goto freeentry; }
base-commit: bc085f8fc88fc16796c9f2364e2bfb3fef305cad
Signature · 1 line
2.30.0
Hi:
Quoted 18 lines · Nathan Chancellor
Clang warns:
mm/zswap.c:1271:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]if (!entry->length) { ^~~~~~~~~~~~~~ mm/zswap.c:1322:9: note: uninitialized use occurs here return ret; ^~~ mm/zswap.c:1271:2: note: remove the 'if' if its condition is always false if (!entry->length) { ^~~~~~~~~~~~~~~~~~~~~ mm/zswap.c:1259:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0
Quoted 8 lines
1 warning generated.
Prior to "mm/zswap: add the flag
can_sleep_mapped", this path always returned 0. Restore that so we are not returning uninitialized memory.
Looks like commit 6753c561f653 ("mm/zswap: add the flag can_sleep_mapped") introduced this warning.
Quoted 23 lines
Signed-off-by Nathan Chancellor <[email protected]>---
Andrew, please fold this into
mm-zswap-add-the-flag-can_sleep_mapped.patch
mm/zswap.c | 1 + 1 file changed, 1 insertion(+)mm/zswap.c +1
-0@@ -1272,6 +1272,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset, dst =kmap_atomic (page);zswap_fill_page (dst, entry->value);kunmap_atomic (dst); + ret =0 ; goto freeentry; }
Quoted 2 lines
base-commit:
bc085f8fc88fc16796c9f2364e2bfb3fef305cad