Skip to content

Commit

Permalink
fs/proc: convert to kstrtoX()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed May 27, 2011
1 parent 57cc083 commit 0a8cb8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 8 additions & 8 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
{
struct task_struct *task;
char buffer[PROC_NUMBUF];
long oom_adjust;
int oom_adjust;
unsigned long flags;
int err;

Expand All @@ -1071,7 +1071,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
goto out;
}

err = strict_strtol(strstrip(buffer), 0, &oom_adjust);
err = kstrtoint(strstrip(buffer), 0, &oom_adjust);
if (err)
goto out;
if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
Expand Down Expand Up @@ -1168,7 +1168,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
struct task_struct *task;
char buffer[PROC_NUMBUF];
unsigned long flags;
long oom_score_adj;
int oom_score_adj;
int err;

memset(buffer, 0, sizeof(buffer));
Expand All @@ -1179,7 +1179,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
goto out;
}

err = strict_strtol(strstrip(buffer), 0, &oom_score_adj);
err = kstrtoint(strstrip(buffer), 0, &oom_score_adj);
if (err)
goto out;
if (oom_score_adj < OOM_SCORE_ADJ_MIN ||
Expand Down Expand Up @@ -1468,7 +1468,7 @@ sched_autogroup_write(struct file *file, const char __user *buf,
struct inode *inode = file->f_path.dentry->d_inode;
struct task_struct *p;
char buffer[PROC_NUMBUF];
long nice;
int nice;
int err;

memset(buffer, 0, sizeof(buffer));
Expand All @@ -1477,9 +1477,9 @@ sched_autogroup_write(struct file *file, const char __user *buf,
if (copy_from_user(buffer, buf, count))
return -EFAULT;

err = strict_strtol(strstrip(buffer), 0, &nice);
if (err)
return -EINVAL;
err = kstrtoint(strstrip(buffer), 0, &nice);
if (err < 0)
return err;

p = get_proc_task(inode);
if (!p)
Expand Down
8 changes: 5 additions & 3 deletions fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
char buffer[PROC_NUMBUF];
struct mm_struct *mm;
struct vm_area_struct *vma;
long type;
int type;
int rv;

memset(buffer, 0, sizeof(buffer));
if (count > sizeof(buffer) - 1)
count = sizeof(buffer) - 1;
if (copy_from_user(buffer, buf, count))
return -EFAULT;
if (strict_strtol(strstrip(buffer), 10, &type))
return -EINVAL;
rv = kstrtoint(strstrip(buffer), 10, &type);
if (rv < 0)
return rv;
if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED)
return -EINVAL;
task = get_proc_task(file->f_path.dentry->d_inode);
Expand Down

0 comments on commit 0a8cb8e

Please sign in to comment.