Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yue Hu <zbestahu@gmail.com>
To: Huang Jianan via Linux-erofs <linux-erofs@lists.ozlabs.org>
Cc: zhangshiming@oppo.com, yh@oppo.com, guanyuwei@oppo.com,
	guoweichao@oppo.com
Subject: Re: [PATCH] erofs-utils: check the return value of erofs_d_alloc
Date: Thu, 18 Nov 2021 18:04:23 +0800	[thread overview]
Message-ID: <20211118180423.0000724e.zbestahu@gmail.com> (raw)
In-Reply-To: <20211117102120.30203-1-huangjianan@oppo.com>

On Wed, 17 Nov 2021 18:21:19 +0800
Huang Jianan via Linux-erofs <linux-erofs@lists.ozlabs.org> wrote:

> Need to check whether the allocation of erofs_dentry is successful.
> 
> Signed-off-by: Huang Jianan <huangjianan@oppo.com>
> ---
>  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 <huyue2@yulong.com>

      parent reply	other threads:[~2021-11-18 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 10:21 [PATCH] erofs-utils: check the return value of erofs_d_alloc Huang Jianan via Linux-erofs
2021-11-17 10:21 ` [PATCH] erofs-utils: fix memory leak when get blob chunk Huang Jianan via Linux-erofs
2021-11-18 10:04 ` Yue Hu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118180423.0000724e.zbestahu@gmail.com \
    --to=zbestahu@gmail.com \
    --cc=guanyuwei@oppo.com \
    --cc=guoweichao@oppo.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=yh@oppo.com \
    --cc=zhangshiming@oppo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox