LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: James Simmons <jsimmons@infradead.org>
Cc: devel@driverdev.osuosl.org,
	Dmitry Eremin <dmitry.eremin@intel.com>,
	James Simmons <uja.ornl@yahoo.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	NeilBrown <neilb@suse.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Oleg Drokin <oleg.drokin@intel.com>,
	"John L. Hammond" <john.hammond@intel.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH v2 1/5] staging: lustre: llite: add support set_acl method in inode operations
Date: Tue, 15 May 2018 14:30:35 +0300	[thread overview]
Message-ID: <20180515113034.ywxhai4nrrvxs7nr@mwanda> (raw)
In-Reply-To: <1526350623-4616-2-git-send-email-jsimmons@infradead.org>

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.

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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2018-05-15 11:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15  2:16 [PATCH 0/5] staging: lustre: llite: remaining xattr fixes James Simmons
2018-05-15  2:16 ` [PATCH v2 1/5] staging: lustre: llite: add support set_acl method in inode operations James Simmons
2018-05-15  3:53   ` NeilBrown
2018-05-15  7:30     ` Greg Kroah-Hartman
2018-05-15 15:01     ` James Simmons
2018-05-15 11:30   ` Dan Carpenter [this message]
2018-05-15 15:00     ` James Simmons
2018-05-15  2:17 ` [PATCH v2 2/5] staging: lustre: llite: remove unused parameters from md_{get, set}xattr() James Simmons
2018-05-15  2:17 ` [PATCH 3/5] staging: lustre: acl: increase ACL entries limitation James Simmons
2018-05-15  2:17 ` [PATCH 4/5] staging: lustre: mdc: excessive memory consumption by the xattr cache James Simmons
2018-05-15  2:17 ` [PATCH 5/5] staging: lustre: mdc: use large xattr buffers for old servers James Simmons

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=20180515113034.ywxhai4nrrvxs7nr@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dmitry.eremin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.hammond@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.com \
    --cc=oleg.drokin@intel.com \
    --cc=uja.ornl@yahoo.com \
    --subject='Re: [PATCH v2 1/5] staging: lustre: llite: add support set_acl method in inode operations' \
    /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

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