[PATCH 1/2] ntfs: Replace ERR_PTR(0) with NULL
From: Ethan Tidmore
Date: Wed Feb 25 2026 - 23:04:51 EST
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@xxxxxxxxx>
---
fs/ntfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index a21eeaec57b4..cecfaabfbfe7 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -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)
--
2.53.0