kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Emil Goode <emilgoode@gmail.com>
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:19:57 +0000	[thread overview]
Message-ID: <20120426211957.GA9514@redhat.com> (raw)
In-Reply-To: <1335474778-6252-1-git-send-email-emilgoode@gmail.com>

On Thu, Apr 26, 2012 at 11:12:58PM +0200, Emil Goode wrote:
 > 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;
 >  	posix_acl_to_xattr(acl, data, len);
 >  	error = gfs2_xattr_acl_chmod(ip, attr, data);

You missed the brackets on the if, introducing a bug that will cause it
to now always fail.

As 'error' gets overwritten in the successful case, there is no reason
to change this afaics.

	Dave

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

Thread overview: 4+ 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:14 ` Oliver Neukum
2012-04-26 21:30   ` Emil Goode
2012-04-26 21:19 ` Dave Jones [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=20120426211957.GA9514@redhat.com \
    --to=davej@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=emilgoode@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).