diff options
author | Aristeu Rozanski <aris@redhat.com> | 2012-10-25 16:37:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-25 17:37:52 -0400 |
commit | 26fd8405dd470cb8b54cb96859b7dd437e5e1391 (patch) | |
tree | c4d77df24842b0d980ccd10e09b00c6230db3176 | |
parent | 5b7aa7d5bb2c5cf7fc05aaa41561af321706ab5f (diff) |
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>
-rw-r--r-- | security/device_cgroup.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 76503df23770..4fbae8d0b36c 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -361,8 +361,8 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
361 | int filetype, const char *buffer) | 361 | int filetype, const char *buffer) |
362 | { | 362 | { |
363 | const char *b; | 363 | const char *b; |
364 | char *endp; | 364 | char temp[12]; /* 11 + 1 characters needed for a u32 */ |
365 | int count; | 365 | int count, rc; |
366 | struct dev_exception_item ex; | 366 | struct dev_exception_item ex; |
367 | 367 | ||
368 | if (!capable(CAP_SYS_ADMIN)) | 368 | if (!capable(CAP_SYS_ADMIN)) |
@@ -405,8 +405,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
405 | ex.major = ~0; | 405 | ex.major = ~0; |
406 | b++; | 406 | b++; |
407 | } else if (isdigit(*b)) { | 407 | } else if (isdigit(*b)) { |
408 | ex.major = simple_strtoul(b, &endp, 10); | 408 | memset(temp, 0, sizeof(temp)); |
409 | b = endp; | 409 | for (count = 0; count < sizeof(temp) - 1; count++) { |
410 | temp[count] = *b; | ||
411 | b++; | ||
412 | if (!isdigit(*b)) | ||
413 | break; | ||
414 | } | ||
415 | rc = kstrtou32(temp, 10, &ex.major); | ||
416 | if (rc) | ||
417 | return -EINVAL; | ||
410 | } else { | 418 | } else { |
411 | return -EINVAL; | 419 | return -EINVAL; |
412 | } | 420 | } |
@@ -419,8 +427,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
419 | ex.minor = ~0; | 427 | ex.minor = ~0; |
420 | b++; | 428 | b++; |
421 | } else if (isdigit(*b)) { | 429 | } else if (isdigit(*b)) { |
422 | ex.minor = simple_strtoul(b, &endp, 10); | 430 | memset(temp, 0, sizeof(temp)); |
423 | b = endp; | 431 | for (count = 0; count < sizeof(temp) - 1; count++) { |
432 | temp[count] = *b; | ||
433 | b++; | ||
434 | if (!isdigit(*b)) | ||
435 | break; | ||
436 | } | ||
437 | rc = kstrtou32(temp, 10, &ex.minor); | ||
438 | if (rc) | ||
439 | return -EINVAL; | ||
424 | } else { | 440 | } else { |
425 | return -EINVAL; | 441 | return -EINVAL; |
426 | } | 442 | } |