* [PATCH -next] mm: pagewalk: Restore err initialization in walk_hugetlb_range()
@ 2022-08-23 15:30 Nathan Chancellor
2022-08-24 5:16 ` Rolf Eike Beer
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2022-08-23 15:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Nick Desaulniers, Tom Rix, Rolf Eike Beer, linux-mm,
linux-kernel, llvm, patches, Nathan Chancellor
Clang warns:
mm/pagewalk.c:318:12: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
else if (ops->pte_hole)
^~~~~~~~~~~~~
mm/pagewalk.c:321:7: note: uninitialized use occurs here
if (err)
^~~
mm/pagewalk.c:318:8: note: remove the 'if' if its condition is always true
else if (ops->pte_hole)
^~~~~~~~~~~~~~~~~~
mm/pagewalk.c:311:10: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
1 error generated.
Restore the initialization of err to zero so that it cannot be used
uninitialized.
Fixes: 9ce1db56225a ("mm: pagewalk: make error checks more obvious")
Link: https://github.com/ClangBuiltLinux/linux/issues/1694
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I am sure that SHA is not stable and I expect this to be squashed into
the original change.
mm/pagewalk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index 54b2a1beeeb3..76e5ccda8c88 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -308,7 +308,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
const struct mm_walk_ops *ops = walk->ops;
for (; addr < end; addr = next) {
- int err;
+ int err = 0;
pte_t *pte = huge_pte_offset(walk->mm, addr & hmask, sz);
next = hugetlb_entry_end(h, addr, end);
base-commit: d711de4adbec4cb0b8769bcae971b13293e6d311
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] mm: pagewalk: Restore err initialization in walk_hugetlb_range()
2022-08-23 15:30 [PATCH -next] mm: pagewalk: Restore err initialization in walk_hugetlb_range() Nathan Chancellor
@ 2022-08-24 5:16 ` Rolf Eike Beer
0 siblings, 0 replies; 2+ messages in thread
From: Rolf Eike Beer @ 2022-08-24 5:16 UTC (permalink / raw)
To: Andrew Morton, Nathan Chancellor
Cc: Nick Desaulniers, Tom Rix, linux-mm, linux-kernel, llvm, patches
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
Am Dienstag, 23. August 2022, 17:30:56 CEST schrieb Nathan Chancellor:
> Restore the initialization of err to zero so that it cannot be used
> uninitialized.
There are actually 3 places that need fixing. I'll send a patch in a minute.
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 313 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-24 5:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 15:30 [PATCH -next] mm: pagewalk: Restore err initialization in walk_hugetlb_range() Nathan Chancellor
2022-08-24 5:16 ` Rolf Eike Beer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).