diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2026-05-15 11:09:50 +0200 |
|---|---|---|
| committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2026-05-28 15:42:18 +0200 |
| commit | d606eb38951564edcc17fe87c557f01a93d77c70 (patch) | |
| tree | dd91d8b3e34518512b742d7c0463a88808a3fba4 /fs | |
| parent | 6b6fbad790ef1c49bd8387b69112a3b96bd1295e (diff) | |
| download | linux-next-history-d606eb38951564edcc17fe87c557f01a93d77c70.tar.gz | |
ntfs3: avoid another -Wmaybe-uninitialized warning
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>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ntfs3/frecord.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 0d98bc932c24d..abab45f6f1802 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); |
