Commit 75e45d51 authored by Dongsheng Yang's avatar Dongsheng Yang Committed by Ingo Molnar
parent d277d868
...@@ -203,7 +203,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice) ...@@ -203,7 +203,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)
struct autogroup *ag; struct autogroup *ag;
int err; int err;
if (nice < -20 || nice > 19) if (nice < MIN_NICE || nice > MAX_NICE)
return -EINVAL; return -EINVAL;
err = security_task_setnice(current, nice); err = security_task_setnice(current, nice);
......
...@@ -2993,7 +2993,7 @@ void set_user_nice(struct task_struct *p, long nice) ...@@ -2993,7 +2993,7 @@ void set_user_nice(struct task_struct *p, long nice)
unsigned long flags; unsigned long flags;
struct rq *rq; struct rq *rq;
if (task_nice(p) == nice || nice < -20 || nice > 19) if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)
return; return;
/* /*
* We have to be careful, if called from sys_setpriority(), * We have to be careful, if called from sys_setpriority(),
...@@ -3072,10 +3072,10 @@ SYSCALL_DEFINE1(nice, int, increment) ...@@ -3072,10 +3072,10 @@ SYSCALL_DEFINE1(nice, int, increment)
increment = 40; increment = 40;
nice = task_nice(current) + increment; nice = task_nice(current) + increment;
if (nice < -20) if (nice < MIN_NICE)
nice = -20; nice = MIN_NICE;
if (nice > 19) if (nice > MAX_NICE)
nice = 19; nice = MAX_NICE;
if (increment < 0 && !can_nice(current, nice)) if (increment < 0 && !can_nice(current, nice))
return -EPERM; return -EPERM;
...@@ -3623,7 +3623,7 @@ static int sched_copy_attr(struct sched_attr __user *uattr, ...@@ -3623,7 +3623,7 @@ static int sched_copy_attr(struct sched_attr __user *uattr,
* XXX: do we want to be lenient like existing syscalls; or do we want * XXX: do we want to be lenient like existing syscalls; or do we want
* to be strict and return an error on out-of-bounds values? * to be strict and return an error on out-of-bounds values?
*/ */
attr->sched_nice = clamp(attr->sched_nice, -20, 19); attr->sched_nice = clamp(attr->sched_nice, MIN_NICE, MAX_NICE);
out: out:
return ret; return ret;
......
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