Skip to content

Commit 1bf15dd

Browse files
arndbaalexandrovich
authored andcommitted
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: 48d9b57 ("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>
1 parent 70d3855 commit 1bf15dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/ntfs3/frecord.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ int ni_expand_list(struct ntfs_inode *ni)
13301330
{
13311331
int err = 0;
13321332
u32 asize, done = 0;
1333-
struct ATTRIB *attr, *ins_attr;
1333+
struct ATTRIB *attr, *ins_attr = NULL;
13341334
struct ATTR_LIST_ENTRY *le;
13351335
bool is_mft = ni->mi.rno == MFT_REC_MFT;
13361336
struct MFT_REF ref;
@@ -1363,7 +1363,7 @@ int ni_expand_list(struct ntfs_inode *ni)
13631363
le16_to_cpu(attr->name_off), true,
13641364
&ins_attr, NULL, NULL);
13651365

1366-
if (err)
1366+
if (err || !ins_attr)
13671367
goto out;
13681368

13691369
memcpy(ins_attr, attr, asize);

0 commit comments

Comments
 (0)