Skip to content

Commit 73f0125

Browse files
anmuxixixinamjaejeon
authored andcommitted
exfat: fix passing zero to ERR_PTR() in exfat_mkdir()
Detected by Smatch. namei.c:890 exfat_mkdir() warn: passing zero to 'ERR_PTR' Signed-off-by: Yang Wen <anmuxixixi@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent d1d75ea commit 73f0125

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

fs/exfat/namei.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,9 +874,10 @@ static struct dentry *exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
874874

875875
i_pos = exfat_make_i_pos(&info);
876876
inode = exfat_build_inode(sb, &info, i_pos);
877-
err = PTR_ERR_OR_ZERO(inode);
878-
if (err)
877+
if (IS_ERR(inode)) {
878+
err = PTR_ERR(inode);
879879
goto unlock;
880+
}
880881

881882
inode_inc_iversion(inode);
882883
EXFAT_I(inode)->i_crtime = simple_inode_init_ts(inode);
@@ -887,7 +888,7 @@ static struct dentry *exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
887888

888889
unlock:
889890
mutex_unlock(&EXFAT_SB(sb)->s_lock);
890-
return ERR_PTR(err);
891+
return err ? ERR_PTR(err) : NULL;
891892
}
892893

893894
static int exfat_check_dir_empty(struct super_block *sb,

0 commit comments

Comments
 (0)