[lustre-devel] [PATCH v2 1/5] staging: lustre: llite: add support set_acl method in inode operations

James Simmons jsimmons at infradead.org
Tue May 15 08:00:22 PDT 2018


> 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
> 
> 


More information about the lustre-devel mailing list