Re: [PATCH] befs: fix return value check in befs_iget()

From: Serge E. Hallyn
Date: Tue Oct 29 2013 - 11:09:54 EST


Quoting Wei Yongjun (weiyj.lk@xxxxxxxxx):
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
>
> In case of error, the function iget_locked() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

Acked-by: Serge Hallyn <serge.hallyn@xxxxxxxxxxxxx>

> ---
> fs/befs/linuxvfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
> index e9c75e2..d714dda 100644
> --- a/fs/befs/linuxvfs.c
> +++ b/fs/befs/linuxvfs.c
> @@ -319,8 +319,8 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
> befs_debug(sb, "---> befs_read_inode() " "inode = %lu", ino);
>
> inode = iget_locked(sb, ino);
> - if (IS_ERR(inode))
> - return inode;
> + if (!inode)
> + return ERR_PTR(-ENOMEM);
> if (!(inode->i_state & I_NEW))
> return inode;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/