ntfs: fix variable dereferenced before check warnings

Detected by Smatch.

lcnalloc.c:736 ntfs_cluster_alloc() error:
  we previously assumed 'rl' could be null (see line 719)

inode.c:3275 ntfs_inode_close() warn:
  variable dereferenced before check 'tmp_nis' (see line 3255)

attrib.c:4952 ntfs_attr_remove() warn:
  variable dereferenced before check 'ni' (see line 4951)

dir.c:1035 ntfs_readdir() error:
  we previously assumed 'private' could be null (see line 850)

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Hyunchul Lee
2026-03-13 08:59:07 +09:00
committed by Namjae Jeon
parent 7cf4b3c768
commit 4e59f8a1a8
5 changed files with 16 additions and 13 deletions

View File

@@ -732,11 +732,13 @@ out:
folio_put(folio);
}
if (likely(!err)) {
if (!rl) {
err = -EIO;
goto out_restore;
}
if (is_dealloc == true)
ntfs_release_dirty_clusters(vol, rl->length);
ntfs_debug("Done.");
if (rl == NULL)
err = -EIO;
goto out_restore;
}
if (err != -ENOSPC)