[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.21.1805151600080.28403@casper.infradead.org>
Date: Tue, 15 May 2018 16:00:22 +0100 (BST)
From: James Simmons <jsimmons@...radead.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org,
Andreas Dilger <andreas.dilger@...el.com>,
Oleg Drokin <oleg.drokin@...el.com>,
NeilBrown <neilb@...e.com>,
Dmitry Eremin <dmitry.eremin@...el.com>,
James Simmons <uja.ornl@...oo.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"John L. Hammond" <john.hammond@...el.com>,
Lustre Development List <lustre-devel@...ts.lustre.org>
Subject: Re: [PATCH v2 1/5] staging: lustre: llite: add support set_acl method
in inode operations
> On Mon, May 14, 2018 at 10:16:59PM -0400, James Simmons wrote:
> > +#ifdef CONFIG_FS_POSIX_ACL
> > struct posix_acl *ll_get_acl(struct inode *inode, int type)
> > {
> > struct ll_inode_info *lli = ll_i2info(inode);
> > @@ -3043,6 +3044,64 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)
> > return acl;
> > }
> >
> > +int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type)
> > +{
> > + struct ll_sb_info *sbi = ll_i2sbi(inode);
> > + struct ptlrpc_request *req = NULL;
> > + const char *name = NULL;
> > + size_t value_size = 0;
> > + char *value = NULL;
> > + int rc;
>
> "rc" needs to be initialized to zero. It's disapppointing that GCC
> doesn't catch this.
Thanks Dan. Will fix.
> > +
> > + switch (type) {
> > + case ACL_TYPE_ACCESS:
> > + name = XATTR_NAME_POSIX_ACL_ACCESS;
> > + if (acl)
> > + rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
> > + break;
> > +
> > + case ACL_TYPE_DEFAULT:
> > + name = XATTR_NAME_POSIX_ACL_DEFAULT;
> > + if (!S_ISDIR(inode->i_mode))
> > + rc = acl ? -EACCES : 0;
> > + break;
> > +
> > + default:
> > + rc = -EINVAL;
> > + break;
> > + }
> > + if (rc)
> > + return rc;
>
> Otherwise rc can be uninitialized here.
>
> regards,
> dan carpenter
>
>
Powered by blists - more mailing lists