Commit 0a8cb8e34149251ad1f280fe099a4f971554639a
Committed by
Linus Torvalds
1 parent
57cc083ad9
fs/proc: convert to kstrtoX()
Convert fs/proc/ from strict_strto*() to kstrto*() functions. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 13 additions and 11 deletions Side-by-side Diff
fs/proc/base.c
... | ... | @@ -1059,7 +1059,7 @@ |
1059 | 1059 | { |
1060 | 1060 | struct task_struct *task; |
1061 | 1061 | char buffer[PROC_NUMBUF]; |
1062 | - long oom_adjust; | |
1062 | + int oom_adjust; | |
1063 | 1063 | unsigned long flags; |
1064 | 1064 | int err; |
1065 | 1065 | |
... | ... | @@ -1071,7 +1071,7 @@ |
1071 | 1071 | goto out; |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - err = strict_strtol(strstrip(buffer), 0, &oom_adjust); | |
1074 | + err = kstrtoint(strstrip(buffer), 0, &oom_adjust); | |
1075 | 1075 | if (err) |
1076 | 1076 | goto out; |
1077 | 1077 | if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) && |
... | ... | @@ -1168,7 +1168,7 @@ |
1168 | 1168 | struct task_struct *task; |
1169 | 1169 | char buffer[PROC_NUMBUF]; |
1170 | 1170 | unsigned long flags; |
1171 | - long oom_score_adj; | |
1171 | + int oom_score_adj; | |
1172 | 1172 | int err; |
1173 | 1173 | |
1174 | 1174 | memset(buffer, 0, sizeof(buffer)); |
... | ... | @@ -1179,7 +1179,7 @@ |
1179 | 1179 | goto out; |
1180 | 1180 | } |
1181 | 1181 | |
1182 | - err = strict_strtol(strstrip(buffer), 0, &oom_score_adj); | |
1182 | + err = kstrtoint(strstrip(buffer), 0, &oom_score_adj); | |
1183 | 1183 | if (err) |
1184 | 1184 | goto out; |
1185 | 1185 | if (oom_score_adj < OOM_SCORE_ADJ_MIN || |
... | ... | @@ -1468,7 +1468,7 @@ |
1468 | 1468 | struct inode *inode = file->f_path.dentry->d_inode; |
1469 | 1469 | struct task_struct *p; |
1470 | 1470 | char buffer[PROC_NUMBUF]; |
1471 | - long nice; | |
1471 | + int nice; | |
1472 | 1472 | int err; |
1473 | 1473 | |
1474 | 1474 | memset(buffer, 0, sizeof(buffer)); |
... | ... | @@ -1477,9 +1477,9 @@ |
1477 | 1477 | if (copy_from_user(buffer, buf, count)) |
1478 | 1478 | return -EFAULT; |
1479 | 1479 | |
1480 | - err = strict_strtol(strstrip(buffer), 0, &nice); | |
1481 | - if (err) | |
1482 | - return -EINVAL; | |
1480 | + err = kstrtoint(strstrip(buffer), 0, &nice); | |
1481 | + if (err < 0) | |
1482 | + return err; | |
1483 | 1483 | |
1484 | 1484 | p = get_proc_task(inode); |
1485 | 1485 | if (!p) |
fs/proc/task_mmu.c
... | ... | @@ -536,15 +536,17 @@ |
536 | 536 | char buffer[PROC_NUMBUF]; |
537 | 537 | struct mm_struct *mm; |
538 | 538 | struct vm_area_struct *vma; |
539 | - long type; | |
539 | + int type; | |
540 | + int rv; | |
540 | 541 | |
541 | 542 | memset(buffer, 0, sizeof(buffer)); |
542 | 543 | if (count > sizeof(buffer) - 1) |
543 | 544 | count = sizeof(buffer) - 1; |
544 | 545 | if (copy_from_user(buffer, buf, count)) |
545 | 546 | return -EFAULT; |
546 | - if (strict_strtol(strstrip(buffer), 10, &type)) | |
547 | - return -EINVAL; | |
547 | + rv = kstrtoint(strstrip(buffer), 10, &type); | |
548 | + if (rv < 0) | |
549 | + return rv; | |
548 | 550 | if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED) |
549 | 551 | return -EINVAL; |
550 | 552 | task = get_proc_task(file->f_path.dentry->d_inode); |