public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use defines in sys_getpriority/sys_setpriority
@ 2007-05-10 17:22 Daniel Walker
  2007-05-10 23:48 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Walker @ 2007-05-10 17:22 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Switch to the defines for these two checks, instead of hard
coding the values.

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

---
 kernel/sys.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.21/kernel/sys.c
===================================================================
--- linux-2.6.21.orig/kernel/sys.c
+++ linux-2.6.21/kernel/sys.c
@@ -598,7 +598,7 @@ asmlinkage long sys_setpriority(int whic
 	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) */
@@ -662,7 +662,7 @@ asmlinkage long sys_getpriority(int whic
 	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);
-- 

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] use defines in sys_getpriority/sys_setpriority
  2007-05-10 17:22 [PATCH] use defines in sys_getpriority/sys_setpriority Daniel Walker
@ 2007-05-10 23:48 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-05-10 23:48 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linux-kernel

On Thu, 10 May 2007 10:22:23 -0700
Daniel Walker <dwalker@mvista.com> wrote:

> Switch to the defines for these two checks, instead of hard
> coding the values.
> 
> Signed-Off-By: Daniel Walker <dwalker@mvista.com>
> 
> ---
>  kernel/sys.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.21/kernel/sys.c
> ===================================================================
> --- linux-2.6.21.orig/kernel/sys.c
> +++ linux-2.6.21/kernel/sys.c
> @@ -598,7 +598,7 @@ asmlinkage long sys_setpriority(int whic
>  	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) */
> @@ -662,7 +662,7 @@ asmlinkage long sys_getpriority(int whic
>  	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);

I added this:

--- a/kernel/sys.c~use-defines-in-sys_getpriority-sys_setpriority-fix
+++ a/kernel/sys.c
@@ -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>
_


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-10 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 17:22 [PATCH] use defines in sys_getpriority/sys_setpriority Daniel Walker
2007-05-10 23:48 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox