Commit 0a8cb8e3 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

fs/proc: convert to kstrtoX()

Convert fs/proc/ from strict_strto*() to kstrto*() functions.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 57cc083a
...@@ -1059,7 +1059,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, ...@@ -1059,7 +1059,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
{ {
struct task_struct *task; struct task_struct *task;
char buffer[PROC_NUMBUF]; char buffer[PROC_NUMBUF];
long oom_adjust; int oom_adjust;
unsigned long flags; unsigned long flags;
int err; int err;
...@@ -1071,7 +1071,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, ...@@ -1071,7 +1071,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
goto out; goto out;
} }
err = strict_strtol(strstrip(buffer), 0, &oom_adjust); err = kstrtoint(strstrip(buffer), 0, &oom_adjust);
if (err) if (err)
goto out; goto out;
if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) && if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
...@@ -1168,7 +1168,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, ...@@ -1168,7 +1168,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
struct task_struct *task; struct task_struct *task;
char buffer[PROC_NUMBUF]; char buffer[PROC_NUMBUF];
unsigned long flags; unsigned long flags;
long oom_score_adj; int oom_score_adj;
int err; int err;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
...@@ -1179,7 +1179,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, ...@@ -1179,7 +1179,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
goto out; goto out;
} }
err = strict_strtol(strstrip(buffer), 0, &oom_score_adj); err = kstrtoint(strstrip(buffer), 0, &oom_score_adj);
if (err) if (err)
goto out; goto out;
if (oom_score_adj < OOM_SCORE_ADJ_MIN || if (oom_score_adj < OOM_SCORE_ADJ_MIN ||
...@@ -1468,7 +1468,7 @@ sched_autogroup_write(struct file *file, const char __user *buf, ...@@ -1468,7 +1468,7 @@ sched_autogroup_write(struct file *file, const char __user *buf,
struct inode *inode = file->f_path.dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
struct task_struct *p; struct task_struct *p;
char buffer[PROC_NUMBUF]; char buffer[PROC_NUMBUF];
long nice; int nice;
int err; int err;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
...@@ -1477,9 +1477,9 @@ sched_autogroup_write(struct file *file, const char __user *buf, ...@@ -1477,9 +1477,9 @@ sched_autogroup_write(struct file *file, const char __user *buf,
if (copy_from_user(buffer, buf, count)) if (copy_from_user(buffer, buf, count))
return -EFAULT; return -EFAULT;
err = strict_strtol(strstrip(buffer), 0, &nice); err = kstrtoint(strstrip(buffer), 0, &nice);
if (err) if (err < 0)
return -EINVAL; return err;
p = get_proc_task(inode); p = get_proc_task(inode);
if (!p) if (!p)
......
...@@ -536,15 +536,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, ...@@ -536,15 +536,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
char buffer[PROC_NUMBUF]; char buffer[PROC_NUMBUF];
struct mm_struct *mm; struct mm_struct *mm;
struct vm_area_struct *vma; struct vm_area_struct *vma;
long type; int type;
int rv;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
if (count > sizeof(buffer) - 1) if (count > sizeof(buffer) - 1)
count = sizeof(buffer) - 1; count = sizeof(buffer) - 1;
if (copy_from_user(buffer, buf, count)) if (copy_from_user(buffer, buf, count))
return -EFAULT; return -EFAULT;
if (strict_strtol(strstrip(buffer), 10, &type)) rv = kstrtoint(strstrip(buffer), 10, &type);
return -EINVAL; if (rv < 0)
return rv;
if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED) if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED)
return -EINVAL; return -EINVAL;
task = get_proc_task(file->f_path.dentry->d_inode); task = get_proc_task(file->f_path.dentry->d_inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment