]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
exfat: fix passing zero to ERR_PTR() in exfat_mkdir()
authorYang Wen <anmuxixixi@gmail.com>
Sun, 22 Mar 2026 15:32:06 +0000 (23:32 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 26 Mar 2026 11:22:26 +0000 (20:22 +0900)
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>
fs/exfat/namei.c

index ef2a3488c1b370cba9675dbb29c2a691a6d306c8..d0ea1ff81c090206755d47210bde296b48963399 100644 (file)
@@ -874,9 +874,10 @@ static struct dentry *exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        i_pos = exfat_make_i_pos(&info);
        inode = exfat_build_inode(sb, &info, i_pos);
-       err = PTR_ERR_OR_ZERO(inode);
-       if (err)
+       if (IS_ERR(inode)) {
+               err = PTR_ERR(inode);
                goto unlock;
+       }
 
        inode_inc_iversion(inode);
        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,
 
 unlock:
        mutex_unlock(&EXFAT_SB(sb)->s_lock);
-       return ERR_PTR(err);
+       return err ? ERR_PTR(err) : NULL;
 }
 
 static int exfat_check_dir_empty(struct super_block *sb,