mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] exfat: fix passing zero to ERR_PTR() in exfat_mkdir()
@ 2026-03-22 15:32 Yang Wen
  2026-03-23 14:52 ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Wen @ 2026-03-22 15:32 UTC (permalink / raw)
  To: linkinjeon, sj1557.seo; +Cc: yuezhang.mo, linux-fsdevel, linux-kernel, Yang Wen

Detected by Smatch.

namei.c:890 exfat_mkdir() warn:
	passing zero to 'ERR_PTR'

Signed-off-by: Yang Wen <anmuxixixi@gmail.com>
---
 fs/exfat/namei.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 670116ae9ec8..2bfdece79b17 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -873,9 +873,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);
@@ -886,7 +887,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,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] exfat: fix passing zero to ERR_PTR() in exfat_mkdir()
  2026-03-22 15:32 [PATCH] exfat: fix passing zero to ERR_PTR() in exfat_mkdir() Yang Wen
@ 2026-03-23 14:52 ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2026-03-23 14:52 UTC (permalink / raw)
  To: Yang Wen; +Cc: sj1557.seo, yuezhang.mo, linux-fsdevel, linux-kernel

On Mon, Mar 23, 2026 at 12:32 AM Yang Wen <anmuxixixi@gmail.com> wrote:
>
> Detected by Smatch.
>
> namei.c:890 exfat_mkdir() warn:
>         passing zero to 'ERR_PTR'
>
> Signed-off-by: Yang Wen <anmuxixixi@gmail.com>
Applied it to #dev.
Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-23 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-22 15:32 [PATCH] exfat: fix passing zero to ERR_PTR() in exfat_mkdir() Yang Wen
2026-03-23 14:52 ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®