Skip to content

Commit

Permalink
exfat: fix pointer error checking
Browse files Browse the repository at this point in the history
Fix missing result check of exfat_build_inode().
And use PTR_ERR_OR_ZERO instead of PTR_ERR.

Signed-off-by: Tetsuhiro Kohada <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
Tetsuhiro Kohada authored and namjaejeon committed Oct 7, 2020
1 parent 549738f commit d6c9efd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions fs/exfat/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,

i_pos = exfat_make_i_pos(&info);
inode = exfat_build_inode(sb, &info, i_pos);
if (IS_ERR(inode))
err = PTR_ERR_OR_ZERO(inode);
if (err)
goto unlock;

inode_inc_iversion(inode);
Expand Down Expand Up @@ -745,10 +746,9 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,

i_pos = exfat_make_i_pos(&info);
inode = exfat_build_inode(sb, &info, i_pos);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
err = PTR_ERR_OR_ZERO(inode);
if (err)
goto unlock;
}

i_mode = inode->i_mode;
alias = d_find_alias(inode);
Expand Down Expand Up @@ -890,10 +890,9 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)

i_pos = exfat_make_i_pos(&info);
inode = exfat_build_inode(sb, &info, i_pos);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
err = PTR_ERR_OR_ZERO(inode);
if (err)
goto unlock;
}

inode_inc_iversion(inode);
inode->i_mtime = inode->i_atime = inode->i_ctime =
Expand Down

0 comments on commit d6c9efd

Please sign in to comment.