From: Arnd Bergmann <arnd@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>,
Suren Baghdasaryan <surenb@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: [PATCH 1/3] mm/mmap/vma_merge: actually set next to NULL if not applicable
Date: Thu, 23 Mar 2023 12:58:34 +0100 [thread overview]
Message-ID: <20230323115903.1483668-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
As clang builds point out, the variable 'next' is now uninitialized
in some conditions as a result of a previous patch that tried to
rely on it being NULL here:
mm/mmap.c:939:11: error: variable 'next' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
else if (!curr)
^~~~~
mm/mmap.c:952:15: note: uninitialized use occurs here
merge_next = next && mpol_equal(policy, vma_policy(next)) &&
^~~~
Fixes: e887ecae997e ("mm/mmap/vma_merge: set next to NULL if not applicable")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
mm/mmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c
index 54099a604cf8..c01d43bd694e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -939,6 +939,8 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
else if (!curr)
/* Is there a VMA next to a hole (case 1 - 3) or prev (4)? */
next = vma_lookup(mm, end);
+ else
+ next = NULL;
/* Can we merge the predecessor? */
if (prev && addr == prev->vm_end && mpol_equal(vma_policy(prev), policy)
--
2.39.2
next reply other threads:[~2023-03-23 11:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 11:58 Arnd Bergmann [this message]
2023-03-23 11:58 ` [PATCH 2/3] mm: vmalloc: fix vmap_ram_vread_iter() return value Arnd Bergmann
2023-03-23 12:05 ` Lorenzo Stoakes
2023-03-23 11:58 ` [PATCH 3/3] mm: vmalloc: mark zero_iter() static Arnd Bergmann
2023-03-23 12:06 ` Lorenzo Stoakes
2023-03-23 12:03 ` [PATCH 1/3] mm/mmap/vma_merge: actually set next to NULL if not applicable Lorenzo Stoakes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230323115903.1483668-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=lstoakes@gmail.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=surenb@google.com \
--cc=trix@redhat.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.