mm/memory_failure: Initialize extra_pins in me_pagecache_clean()
Subsystems (2)
PATCH 1/1 mm/memory_failure: Initialize extra_pins in me_pagecache_clean()
Clang warns:
mm/memory-failure.c:892:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (!mapping) {
^~~~~~~~mm/memory-failure.c:915:32: note: uninitialized use occurs here
if (has_extra_refcount(ps, p, extra_pins))
^~~~~~~~~~mm/memory-failure.c:892:2: note: remove the 'if' if its condition is always false
if (!mapping) {
^~~~~~~~~~~~~~~
mm/memory-failure.c:879:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (PageAnon(p)) {
^~~~~~~~~~~mm/memory-failure.c:915:32: note: uninitialized use occurs here
if (has_extra_refcount(ps, p, extra_pins))
^~~~~~~~~~mm/memory-failure.c:879:2: note: remove the 'if' if its condition is always false
if (PageAnon(p)) {
^~~~~~~~~~~~~~~~~~
mm/memory-failure.c:871:17: note: initialize the variable 'extra_pins' to silence this warning
bool extra_pins;
^
= 02 errors generated.
Initialize extra_pins to false so that it is not used uninitialized.
---
I am aware the fixes tag is not stable. It is there to convey this should be squashed into mm-shmem-dont-truncate-page-if-memory-failure-happens.patch.
mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c +1 -1
@@ -868,7 +868,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) {int ret;struct address_space *mapping; -bool extra_pins; +bool extra_pins = false;delete_from_lru_cache (p);
Signature · 1 line
2.33.1.637.gf443b226ca
Quoted 29 lines · Nathan Chancellor
Clang warns:
mm/memory-failure.c:892:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]if (!mapping) { ^~~~~~~~
mm/memory-failure.c:915:32: note: uninitialized use occurs here
if (has_extra_refcount(ps, p, extra_pins))
^~~~~~~~~~mm/memory-failure.c:892:2: note: remove the 'if' if its condition is always falseif (!mapping) { ^~~~~~~~~~~~~~~ mm/memory-failure.c:879:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (PageAnon(p)) { ^~~~~~~~~~~
mm/memory-failure.c:915:32: note: uninitialized use occurs here
if (has_extra_refcount(ps, p, extra_pins))
^~~~~~~~~~mm/memory-failure.c:879:2: note: remove the 'if' if its condition is always falseif (PageAnon(p)) { ^~~~~~~~~~~~~~~~~~ mm/memory-failure.c:871:17: note: initialize the variable 'extra_pins' to silence this warning bool extra_pins; ^ = 02 errors generated.
Initialize
extra_pinsto false so that it is not used uninitialized.
Quoted 8 lines
Fixes d882a43a0011 ("mm: shmem: don't truncate page if memory failure happens")Reported-by "kernelci.org bot" <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
I am aware the fixes tag is not stable. It is there to convey this should be squashed into mm-shmem-dont-truncate-page-if-memory-failure-happens.patch.
Thanks for catching this. Acked-by: Yang Shi <[email protected]>
Quoted 20 lines
mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memory-failure.c +1
-2@@ -868,7 +868,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) {int ret;struct address_space *mapping; -bool extra_pins; +bool extra_pins = false;delete_from_lru_cache (p); --2.33.1.637.gf443b226ca