]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ntfs: Replace ERR_PTR(0) with NULL
authorEthan Tidmore <ethantidmore06@gmail.com>
Thu, 26 Feb 2026 04:03:54 +0000 (22:03 -0600)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 26 Feb 2026 09:26:09 +0000 (18:26 +0900)
The variable err is confirmed to be 0 and then never reassigned in the
success path. The function then returns with ERR_PTR(err) which just
equals NULL and can be misleading.

Detected by Smatch:
fs/ntfs/namei.c:1091 ntfs_mkdir() warn:
passing zero to 'ERR_PTR'

Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/namei.c

index a21eeaec57b4e47330e72c8b2f52cc4848b2aba4..cecfaabfbfe7f4ecfb812a6d75679a56da36fc22 100644 (file)
@@ -1088,7 +1088,7 @@ static struct dentry *ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        }
 
        d_instantiate_new(dentry, VFS_I(ni));
-       return ERR_PTR(err);
+       return NULL;
 }
 
 static int ntfs_rmdir(struct inode *dir, struct dentry *dentry)