All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Pavel Emelianov <xemul@openvz.org>
Subject: Re: [PATCH] devcgroup: code cleanup
Date: Mon, 7 Jul 2008 10:54:52 -0500	[thread overview]
Message-ID: <20080707155452.GG11250@us.ibm.com> (raw)
In-Reply-To: <486F1509.4020509@cn.fujitsu.com>

Quoting Li Zefan (lizf@cn.fujitsu.com):
> - remove a redundant memset()
> - use simple_strtoul() to parse major/minor
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

Thanks, all look good.

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks
-serge

> ---
>  security/device_cgroup.c |   15 +++------------
>  1 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> index ddd92ce..98826b0 100644
> --- a/security/device_cgroup.c
> +++ b/security/device_cgroup.c
> @@ -188,7 +188,7 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup_subsys *ss,
>  		}
>  		wh->minor = wh->major = ~0;
>  		wh->type = DEV_ALL;
> -		wh->access = ACC_MKNOD | ACC_READ | ACC_WRITE;
> +		wh->access = ACC_MASK;
>  		list_add(&wh->list, &dev_cgroup->whitelist);
>  	} else {
>  		parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup);
> @@ -250,7 +250,6 @@ static char type_to_char(short type)
> 
>  static void set_majmin(char *str, unsigned m)
>  {
> -	memset(str, 0, MAJMINLEN);
>  	if (m == ~0)
>  		sprintf(str, "*");
>  	else
> @@ -405,11 +404,7 @@ static ssize_t devcgroup_access_write(struct cgroup *cgroup, struct cftype *cft,
>  		wh.major = ~0;
>  		b++;
>  	} else if (isdigit(*b)) {
> -		wh.major = 0;
> -		while (isdigit(*b)) {
> -			wh.major = wh.major*10+(*b-'0');
> -			b++;
> -		}
> +		wh.major = simple_strtoul(b, &b, 0);
>  	} else {
>  		retval = -EINVAL;
>  		goto out2;
> @@ -425,11 +420,7 @@ static ssize_t devcgroup_access_write(struct cgroup *cgroup, struct cftype *cft,
>  		wh.minor = ~0;
>  		b++;
>  	} else if (isdigit(*b)) {
> -		wh.minor = 0;
> -		while (isdigit(*b)) {
> -			wh.minor = wh.minor*10+(*b-'0');
> -			b++;
> -		}
> +		wh.minor = simple_strtoul(b, &b, 0);
>  	} else {
>  		retval = -EINVAL;
>  		goto out2;
> -- 
> 1.5.4.rc3

      reply	other threads:[~2008-07-07 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-05  6:30 [PATCH] devcgroup: code cleanup Li Zefan
2008-07-07 15:54 ` Serge E. Hallyn [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=20080707155452.GG11250@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=xemul@openvz.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.