public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: miklos@szeredi.hu, linux-unionfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ovl: Avoid some memory allocation
Date: Sat, 11 Feb 2017 12:05:36 +0100	[thread overview]
Message-ID: <589EF000.7050808@bfs.de> (raw)
In-Reply-To: <20170210211814.18257-1-christophe.jaillet@wanadoo.fr>



Am 10.02.2017 22:18, schrieb Christophe JAILLET:
> Reorder code to avoid allocating and then freeing some memory in an error
> handling path.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  fs/overlayfs/namei.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index 023bb0b03352..ba80ebb8a104 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -35,13 +35,13 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d,
>  			return 0;
>  		goto fail;
>  	}
> +	if (res == 0)
> +		goto invalid;
> +


perhaps:

   if (res == -ENODATA || res == -EOPNOTSUPP)
	return 0;
	
   if (ret < 0)
	goto fail;

   if (ret == 0)
	goto invalid;

I think its better to read, i guess the author also as we can find this
pattern after the other vfs_getxattr() also.

re,
 wh

>  	buf = kzalloc(prelen + res + strlen(post) + 1, GFP_TEMPORARY);
>  	if (!buf)
>  		return -ENOMEM;
>  
> -	if (res == 0)
> -		goto invalid;
> -
>  	res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res);
>  	if (res < 0)
>  		goto fail;

      reply	other threads:[~2017-02-11 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 21:18 [PATCH] ovl: Avoid some memory allocation Christophe JAILLET
2017-02-11 11:05 ` walter harms [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=589EF000.7050808@bfs.de \
    --to=wharms@bfs.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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