Skip to content

Commit

Permalink
use defines in sys_getpriority/sys_setpriority
Browse files Browse the repository at this point in the history
Switch to the defines for these two checks, instead of hard coding the
values.

[[email protected]: add missing include]
Signed-off-by: Daniel Walker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Daniel Walker authored and Linus Torvalds committed May 11, 2007
1 parent 00b8fd2 commit 3e88c55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/prctl.h>
#include <linux/highuid.h>
#include <linux/fs.h>
#include <linux/resource.h>
#include <linux/kernel.h>
#include <linux/kexec.h>
#include <linux/workqueue.h>
Expand Down Expand Up @@ -659,7 +660,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
int error = -EINVAL;
struct pid *pgrp;

if (which > 2 || which < 0)
if (which > PRIO_USER || which < PRIO_PROCESS)
goto out;

/* normalize: avoid signed division (rounding problems) */
Expand Down Expand Up @@ -723,7 +724,7 @@ asmlinkage long sys_getpriority(int which, int who)
long niceval, retval = -ESRCH;
struct pid *pgrp;

if (which > 2 || which < 0)
if (which > PRIO_USER || which < PRIO_PROCESS)
return -EINVAL;

read_lock(&tasklist_lock);
Expand Down

0 comments on commit 3e88c55

Please sign in to comment.