mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Don't compare unsigned variable for <0 in sys_prctl()
@ 2006-11-28 22:17 Jesper Juhl
  2006-11-28 22:27 ` Linus Torvalds
  2006-11-28 22:58 ` Friends dont let friends use GCC -W (was Re: [PATCH] Don't compare unsigned Valdis.Kletnieks
  0 siblings, 2 replies; 8+ messages in thread
From: Jesper Juhl @ 2006-11-28 22:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Andrew Morton, trivial, Jesper Juhl


In kernel/sys.c::sys_prctl() the argument named 'arg2' is very clearly 
of type 'unsigned long', and when compiling with "gcc -W" gcc also warns :
  kernel/sys.c:2089: warning: comparison of unsigned expression < 0 is always false

So this patch removes the test of "arg2 < 0".

For those of us who compile their kernels with "-W" this gets rid of an 
annoying warning. For the rest of you it saves a few bytes of source code ;-)


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

diff --git a/kernel/sys.c b/kernel/sys.c
index 98489d8..086ea37 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2086,7 +2086,7 @@ asmlinkage long sys_prctl(int option, un
 			error = current->mm->dumpable;
 			break;
 		case PR_SET_DUMPABLE:
-			if (arg2 < 0 || arg2 > 1) {
+			if (arg2 > 1) {
 				error = -EINVAL;
 				break;
 			}



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

end of thread, other threads:[~2006-11-29  1:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-28 22:17 [PATCH] Don't compare unsigned variable for <0 in sys_prctl() Jesper Juhl
2006-11-28 22:27 ` Linus Torvalds
2006-11-28 22:34   ` Jesper Juhl
2006-11-28 23:06     ` Linus Torvalds
2006-11-28 23:42       ` Jesper Juhl
2006-11-29  0:13         ` Linus Torvalds
2006-11-29  1:10           ` Jesper Juhl
2006-11-28 22:58 ` Friends dont let friends use GCC -W (was Re: [PATCH] Don't compare unsigned Valdis.Kletnieks

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

all inboxes | Powered by JetHome®