Skip to contentSkip to conversation

nilfs2: Fix return in nilfs_mkdir

PATCH Applied Ryusuke Konishi 2 participants 2 messages May 20 NILFS2 filesystem

lore
Share & tools
lore

Ryusuke Konishi

author maintainer
#0 lore raw

PATCH 1/1 nilfs2: Fix return in nilfs_mkdir

From: Hongling Zeng <[email protected]>

Return NULL instead of passing zero to ERR_PTR.
Fixes smatch warning:
- fs/nilfs2/namei.c:261 nilfs_mkdir() warn: passing zero to 'ERR_PTR'

Fixes 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")

---
Hi Viacheslav,

Please add this to the queue for the next cycle.

This is one of the fixes by Hongling Zeng, a patch that individually corrects a semantic issue (which is harmless in execution) related to the use of the ERR_PTR macro that arose from a recent VFS change.

Thanks,
Ryusuke Konishi

 fs/nilfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/namei.c +1 -1
index 40ac679ec56e..e2fe95de3d71 100644
@@ -258,7 +258,7 @@ static struct dentry *nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 	else
 		nilfs_transaction_abort(dir->i_sb);
 
-	return ERR_PTR(err);
+	return err ? ERR_PTR(err) : NULL;
 
 out_fail:
 	drop_nlink(inode);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 29 lines · Ryusuke Konishi

From: Hongling Zeng <[email protected]>

Return NULL instead of passing zero to ERR_PTR.
Fixes smatch warning:
- fs/nilfs2/namei.c:261 nilfs_mkdir() warn: passing zero to 'ERR_PTR'

Fixes 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")

---
Hi Viacheslav,

Please add this to the queue for the next cycle.

This is one of the fixes by Hongling Zeng, a patch that individually corrects a semantic issue (which is harmless in execution) related to the use of the ERR_PTR macro that arose from a recent VFS change.

Thanks,
Ryusuke Konishi

 fs/nilfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/namei.c +0 -0
index 40ac679ec56e..e2fe95de3d71 100644

fs/nilfs2/namei.c static struct dentry *nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · line 264

Quoted 8 lines
fs/nilfs2/namei.c +1 -1
@@ -258,7 +258,7 @@ static struct dentry *nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 	else
 		nilfs_transaction_abort(dir->i_sb);
 
-	return ERR_PTR(err);
+	return err ? ERR_PTR(err) : NULL;
 
 out_fail:
 	drop_nlink(inode);

Applied.

Thanks,
Slava.