From: Andrew Morton <akpm@linux-foundation.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Serge E. Hallyn" <serue@us.ibm.com>,
Paul Menage <menage@google.com>,
Pavel Emelianov <xemul@openvz.org>
Subject: Re: [PATCH 3/3] devcgroup: code cleanup
Date: Sat, 12 Jul 2008 22:59:08 -0700 [thread overview]
Message-ID: <20080712225908.580649fa.akpm@linux-foundation.org> (raw)
In-Reply-To: <4872C811.8060608@cn.fujitsu.com>
On Tue, 08 Jul 2008 09:51:13 +0800 Li Zefan <lizf@cn.fujitsu.com> wrote:
> @@ -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);
This is an interface change. Previously we only took decimal input.
Now, we accept decimal or octal or hex, based upon automagic detection.
So scripts which were feeding in "010" will now be setting things to eight,
not to ten.
Methinks we should do this:
--- a/security/device_cgroup.c~devcgroup-code-cleanup-fix
+++ a/security/device_cgroup.c
@@ -394,7 +394,7 @@ static int devcgroup_update_access(struc
wh.major = ~0;
b++;
} else if (isdigit(*b)) {
- wh.major = simple_strtoul(b, &b, 0);
+ wh.major = simple_strtoul(b, &b, 10);
} else {
return -EINVAL;
}
@@ -407,7 +407,7 @@ static int devcgroup_update_access(struc
wh.minor = ~0;
b++;
} else if (isdigit(*b)) {
- wh.minor = simple_strtoul(b, &b, 0);
+ wh.minor = simple_strtoul(b, &b, 10);
} else {
return -EINVAL;
}
_
prev parent reply other threads:[~2008-07-13 6:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 1:51 [PATCH 3/3] devcgroup: code cleanup Li Zefan
2008-07-13 5:59 ` Andrew Morton [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=20080712225908.580649fa.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--cc=serue@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox