NTFS3 file system kernel mode driver
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Edward Adam Davis <eadavis@qq.com>,
	Sun Jian <sun.jian.kdev@gmail.com>, <ntfs3@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ntfs3: avoid another -Wmaybe-uninitialized warning
Date: Thu, 28 May 2026 15:48:52 +0200	[thread overview]
Message-ID: <201d0fa6-80b7-46d5-bf2c-01acfa8c8f34@paragon-software.com> (raw)
In-Reply-To: <20260515090956.512083-1-arnd@kernel.org>


On 5/15/26 11:09, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The ntfs3 specific -Wmaybe-uninitialized flag found one more false-postive,
> this time with gcc-10 on s390:
>
> fs/ntfs3/frecord.c: In function 'ni_expand_list':
> fs/ntfs3/frecord.c:1370:16: error: 'ins_attr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> Add an explicit NULL pointer check before using the pointer, and
> initialize it to NULL.
>
> Fixes: 48d9b57b169f ("fs/ntfs3: add a subset of W=1 warnings for stricter checks")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   fs/ntfs3/frecord.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 7b035da63c12..d2c0b836b1bd 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -1330,7 +1330,7 @@ int ni_expand_list(struct ntfs_inode *ni)
>   {
>   	int err = 0;
>   	u32 asize, done = 0;
> -	struct ATTRIB *attr, *ins_attr;
> +	struct ATTRIB *attr, *ins_attr = NULL;
>   	struct ATTR_LIST_ENTRY *le;
>   	bool is_mft = ni->mi.rno == MFT_REC_MFT;
>   	struct MFT_REF ref;
> @@ -1363,7 +1363,7 @@ int ni_expand_list(struct ntfs_inode *ni)
>   				      le16_to_cpu(attr->name_off), true,
>   				      &ins_attr, NULL, NULL);
>   
> -		if (err)
> +		if (err || !ins_attr)
>   			goto out;
>   
>   		memcpy(ins_attr, attr, asize);

Hello,

Applied, thanks for the patch.

Regards,
Konstantin


      reply	other threads:[~2026-05-28 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  9:09 [PATCH] ntfs3: avoid another -Wmaybe-uninitialized warning Arnd Bergmann
2026-05-28 13:48 ` Konstantin Komarov [this message]

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=201d0fa6-80b7-46d5-bf2c-01acfa8c8f34@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=sun.jian.kdev@gmail.com \
    --cc=willy@infradead.org \
    /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