[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1335475838.3035.4.camel@localhost>
Date: Thu, 26 Apr 2012 23:30:38 +0200
From: Emil Goode <emilgoode@...il.com>
To: Oliver Neukum <oliver@...kum.org>
Cc: swhiteho@...hat.com, cluster-devel@...hat.com,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] GFS2: Return -ENOMEM only if kmalloc fails
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists