From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f66.google.com ([74.125.83.66]:34774 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbdAWOKa (ORCPT ); Mon, 23 Jan 2017 09:10:30 -0500 Received: by mail-pg0-f66.google.com with SMTP id t6so13854529pgt.1 for ; Mon, 23 Jan 2017 06:10:30 -0800 (PST) From: Wei Yongjun To: Miklos Szeredi , Fabian Frederick , Andrew Morton , Al Viro , Jan Kara , Boaz Harrosh Cc: Wei Yongjun , linux-fsdevel@vger.kernel.org Subject: [PATCH -next] fs/affs: fix return value check in affs_get_parent() Date: Mon, 23 Jan 2017 14:10:18 +0000 Message-Id: <20170123141018.2331-1-weiyj.lk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Wei Yongjun 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") Signed-off-by: Wei Yongjun --- fs/affs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/affs/namei.c b/fs/affs/namei.c index a3df8a6..96dd1d0 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -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));