All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	trivial@kernel.org, Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] Don't compare unsigned variable for <0 in sys_prctl()
Date: Tue, 28 Nov 2006 23:17:13 +0100	[thread overview]
Message-ID: <200611282317.14020.jesper.juhl@gmail.com> (raw)


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;
 			}



             reply	other threads:[~2006-11-28 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-28 22:17 Jesper Juhl [this message]
2006-11-28 22:27 ` [PATCH] Don't compare unsigned variable for <0 in sys_prctl() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200611282317.14020.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.