All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Goode <emilgoode@gmail.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: swhiteho@redhat.com, cluster-devel@redhat.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] GFS2: Return -ENOMEM only if kmalloc fails
Date: Thu, 26 Apr 2012 21:30:38 +0000	[thread overview]
Message-ID: <1335475838.3035.4.camel@localhost> (raw)
In-Reply-To: <201204262314.02683.oliver@neukum.org>

I forgot the braces, embarrassing!
I see your point, thanks.

Best regards, Emil

On Thu, 2012-04-26 at 23:14 +0200, Oliver Neukum wrote:
> Am Donnerstag, 26. April 2012, 23:12:58 schrieb Emil Goode:
> > The error variable should be assigned the value of -ENOMEM
> > after the NULL check and not before.
> > 
> > Signed-off-by: Emil Goode <emilgoode@gmail.com>
> > ---
> >  fs/gfs2/acl.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
> > index 230eb0f..90f6328 100644
> > --- a/fs/gfs2/acl.c
> > +++ b/fs/gfs2/acl.c
> > @@ -174,8 +174,8 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
> >  
> >  	len = posix_acl_to_xattr(acl, NULL, 0);
> >  	data = kmalloc(len, GFP_NOFS);
> > -	error = -ENOMEM;
> >  	if (data = NULL)
> > +		error = -ENOMEM;
> >  		goto out;
> 
> Hint: read about the syntax of the if statement.
> Secondly, consider how the compiler can optimize the original.
> 
> 	Regards
> 		Oliver



WARNING: multiple messages have this Message-ID (diff)
From: Emil Goode <emilgoode@gmail.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: swhiteho@redhat.com, cluster-devel@redhat.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] GFS2: Return -ENOMEM only if kmalloc fails
Date: Thu, 26 Apr 2012 23:30:38 +0200	[thread overview]
Message-ID: <1335475838.3035.4.camel@localhost> (raw)
In-Reply-To: <201204262314.02683.oliver@neukum.org>

I forgot the braces, embarrassing!
I see your point, thanks.

Best regards, Emil

On Thu, 2012-04-26 at 23:14 +0200, Oliver Neukum wrote:
> Am Donnerstag, 26. April 2012, 23:12:58 schrieb Emil Goode:
> > The error variable should be assigned the value of -ENOMEM
> > after the NULL check and not before.
> > 
> > Signed-off-by: Emil Goode <emilgoode@gmail.com>
> > ---
> >  fs/gfs2/acl.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
> > index 230eb0f..90f6328 100644
> > --- a/fs/gfs2/acl.c
> > +++ b/fs/gfs2/acl.c
> > @@ -174,8 +174,8 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
> >  
> >  	len = posix_acl_to_xattr(acl, NULL, 0);
> >  	data = kmalloc(len, GFP_NOFS);
> > -	error = -ENOMEM;
> >  	if (data == NULL)
> > +		error = -ENOMEM;
> >  		goto out;
> 
> Hint: read about the syntax of the if statement.
> Secondly, consider how the compiler can optimize the original.
> 
> 	Regards
> 		Oliver



  reply	other threads:[~2012-04-26 21:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 21:12 [PATCH] GFS2: Return -ENOMEM only if kmalloc fails Emil Goode
2012-04-26 21:12 ` Emil Goode
2012-04-26 21:14 ` Oliver Neukum
2012-04-26 21:14   ` Oliver Neukum
2012-04-26 21:30   ` Emil Goode [this message]
2012-04-26 21:30     ` Emil Goode
2012-04-26 21:19 ` Dave Jones
2012-04-26 21:19   ` Dave Jones

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=1335475838.3035.4.camel@localhost \
    --to=emilgoode@gmail.com \
    --cc=cluster-devel@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=swhiteho@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.