On Wed, 17 Nov 2021 18:21:19 +0800
Huang Jianan via Linux-erofs <[email protected]> wrote:

> Need to check whether the allocation of erofs_dentry is successful.
> 
> Signed-off-by: Huang Jianan <[email protected]>
> ---
>  lib/inode.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/inode.c b/lib/inode.c
> index 5cbfc78..2fa74e2 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -162,11 +162,15 @@ int erofs_prepare_dir_file(struct erofs_inode *dir, 
> unsigned int nr_subdirs)
>  
>       /* dot is pointed to the current dir inode */
>       d = erofs_d_alloc(dir, ".");
> +     if (IS_ERR(d))
> +             return PTR_ERR(d);
>       d->inode = erofs_igrab(dir);
>       d->type = EROFS_FT_DIR;
>  
>       /* dotdot is pointed to the parent dir */
>       d = erofs_d_alloc(dir, "..");
> +     if (IS_ERR(d))
> +             return PTR_ERR(d);
>       d->inode = erofs_igrab(dir->i_parent);
>       d->type = EROFS_FT_DIR;
>  

Looks good to me

Reviewed-by: Yue Hu <[email protected]>

Reply via email to