Skip to contentSkip to conversation

fs/affs: fix return value check in affs_get_parent()

PATCH New Wei Yongjun 1 participant 1 message Jan 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/affs: fix return value check in affs_get_parent()

From: Wei Yongjun <[email protected]>

In case of error, the function affs_bread() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes e393e82a7d09 ("fs/affs: make export work with cold dcache")
---
 fs/affs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/affs/namei.c +2 -2
index a3df8a6..96dd1d0 100644
@@ -453,8 +453,8 @@ static struct dentry *affs_get_parent(struct dentry *child)
 	struct buffer_head *bh;
 
 	bh = affs_bread(child->d_sb, d_inode(child)->i_ino);
-	if (IS_ERR(bh))
-		return ERR_CAST(bh);
+	if (!bh)
+		return ERR_PTR(-EIO);
 
 	parent = affs_iget(child->d_sb,
 			   be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent));