[PATCH] fs/ntfs3: fix Smatch warnings

Konstantin Komarov posted 1 patch 2 months ago
fs/ntfs3/attrib.c  | 2 +-
fs/ntfs3/frecord.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] fs/ntfs3: fix Smatch warnings
Posted by Konstantin Komarov 2 months ago
Initialize err in ni_allocate_da_blocks_locked() and correct the
pre_alloc condition in attr_allocate_clusters().

Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/ntfs3/attrib.c  | 2 +-
 fs/ntfs3/frecord.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 6b5b58ebbf85..e61c5bf7e27e 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -173,7 +173,7 @@ int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
 
 		if (err == -ENOSPC && pre) {
 			pre = 0;
-			if (*pre_alloc)
+			if (pre_alloc)
 				*pre_alloc = 0;
 			continue;
 		}
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index c0b9ca2426ab..7b035da63c12 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3267,7 +3267,7 @@ int ni_allocate_da_blocks(struct ntfs_inode *ni)
  */
 int ni_allocate_da_blocks_locked(struct ntfs_inode *ni)
 {
-	int err;
+	int err = 0;
 
 	if (!ni->file.run_da.count)
 		return 0;
-- 
2.43.0