From: Arnd Bergmann <arnd@kernel.org>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Moon Hee Lee <moonhee.lee.ca@gmail.com>,
Seunghun Han <kkamagui@gmail.com>, Kees Cook <kees@kernel.org>,
Deepanshu Kartikey <kartikey406@gmail.com>,
Andrey Vatoropin <a.vatoropin@crpt.ru>,
Lalit Shankar Chowdhury <lalitshankarch@gmail.com>,
Lizhi Xu <lizhi.xu@windriver.com>,
Adarsh Das <adarshdas950@gmail.com>,
Jaehun Gou <p22gone@gmail.com>,
ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] ntfs3: avoid -Wmaybe-uninitialized warning
Date: Tue, 21 Apr 2026 22:26:20 +0200 [thread overview]
Message-ID: <20260421202641.1157171-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
This warning shows up with gcc-10 now:
In file included from fs/ntfs3/index.c:15:
fs/ntfs3/index.c: In function 'indx_add_allocate':
fs/ntfs3/ntfs_fs.h:463:9: error: 'bmp_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
463 | return attr_set_size_ex(ni, type, name, name_len, run, new_size,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464 | new_valid, keep_prealloc, NULL, false);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs3/index.c:1498:6: note: 'bmp_size' was declared here
1498 | u64 bmp_size, bmp_size_v;
| ^~~~~~~~
The warning does look correct, as the 'out2' label can be reached
without initializing bmp_size and bmp_size_v. Initialize these at
the same place as bmp.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Note that this is one is separate from the one I reported with KCSAN
---
fs/ntfs3/index.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 5344b29b0577..2b8b5779ff8a 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -1506,6 +1506,7 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni,
if (bit != MINUS_ONE_T) {
bmp = NULL;
+ bmp_size = bmp_size_v = 0;
} else {
if (bmp->non_res) {
bmp_size = le64_to_cpu(bmp->nres.data_size);
--
2.39.5
reply other threads:[~2026-04-21 20:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260421202641.1157171-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=a.vatoropin@crpt.ru \
--cc=adarshdas950@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=arnd@arndb.de \
--cc=kartikey406@gmail.com \
--cc=kees@kernel.org \
--cc=kkamagui@gmail.com \
--cc=lalitshankarch@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.xu@windriver.com \
--cc=moonhee.lee.ca@gmail.com \
--cc=ntfs3@lists.linux.dev \
--cc=p22gone@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox