OSDN Git Service

exfat: fix pointer error checking
authorTetsuhiro Kohada <kohada.t2@gmail.com>
Wed, 26 Aug 2020 01:18:29 +0000 (10:18 +0900)
committerNamjae Jeon <namjae.jeon@samsung.com>
Wed, 7 Oct 2020 05:26:55 +0000 (14:26 +0900)
Fix missing result check of exfat_build_inode().
And use PTR_ERR_OR_ZERO instead of PTR_ERR.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
fs/exfat/namei.c

index e73f20f..c94ac23 100644 (file)
@@ -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);
@@ -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);
@@ -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 =