Re: [PATCH 1/2] ntfs: Replace ERR_PTR(0) with NULL
From: Hyunchul Lee
Date: Thu Feb 26 2026 - 00:39:33 EST
On Wed, Feb 25, 2026 at 10:03:54PM -0600, Ethan Tidmore wrote:
> 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>
Looks good to me. Thanks for the patch.
Reviewed-by: Hyunchul Lee <hyc.lee@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
>
--
Thanks,
Hyunchul