device_cgroup: stop using simple_strtoul()
Convert the code to use kstrtou32() instead of simple_strtoul() which is deprecated. The real size of the variables are u32, so use kstrtou32 instead of kstrtoul Signed-off-by: Aristeu Rozanski <aris@redhat.com> Cc: Dave Jones <davej@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: James Morris <jmorris@namei.org> Cc: Pavel Emelyanov <xemul@openvz.org> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5b7aa7d5bb
commit
26fd8405dd
1 changed files with 22 additions and 6 deletions
|
@ -361,8 +361,8 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup,
|
||||||
int filetype, const char *buffer)
|
int filetype, const char *buffer)
|
||||||
{
|
{
|
||||||
const char *b;
|
const char *b;
|
||||||
char *endp;
|
char temp[12]; /* 11 + 1 characters needed for a u32 */
|
||||||
int count;
|
int count, rc;
|
||||||
struct dev_exception_item ex;
|
struct dev_exception_item ex;
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
|
@ -405,8 +405,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup,
|
||||||
ex.major = ~0;
|
ex.major = ~0;
|
||||||
b++;
|
b++;
|
||||||
} else if (isdigit(*b)) {
|
} else if (isdigit(*b)) {
|
||||||
ex.major = simple_strtoul(b, &endp, 10);
|
memset(temp, 0, sizeof(temp));
|
||||||
b = endp;
|
for (count = 0; count < sizeof(temp) - 1; count++) {
|
||||||
|
temp[count] = *b;
|
||||||
|
b++;
|
||||||
|
if (!isdigit(*b))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rc = kstrtou32(temp, 10, &ex.major);
|
||||||
|
if (rc)
|
||||||
|
return -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -419,8 +427,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup,
|
||||||
ex.minor = ~0;
|
ex.minor = ~0;
|
||||||
b++;
|
b++;
|
||||||
} else if (isdigit(*b)) {
|
} else if (isdigit(*b)) {
|
||||||
ex.minor = simple_strtoul(b, &endp, 10);
|
memset(temp, 0, sizeof(temp));
|
||||||
b = endp;
|
for (count = 0; count < sizeof(temp) - 1; count++) {
|
||||||
|
temp[count] = *b;
|
||||||
|
b++;
|
||||||
|
if (!isdigit(*b))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rc = kstrtou32(temp, 10, &ex.minor);
|
||||||
|
if (rc)
|
||||||
|
return -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue