[PATCH] Don't compare unsigned variable for <0 in sys_prctl()




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@xxxxxxxxx>
---

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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Nokia c110 driver
    ... | I was attempting to compile the nokia c110 linux driver, ... | kernels, on 2.6.3. ... | are the errors the compile gives. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Compiling kernel 2.6.16 or higher under Sarge
    ... I've never followed the "Current Minimal Requirements" list, and have used the latest kernels for many years on all versions of Debian stable. ... > Can I compile 2.6.16 from source under Sarge? ... but would recommend the latest from kernel.org to get the newest security patches. ...
    (Debian-User)
  • How to enable/disable security features on mmap() ?
    ... For educational purpose (I'm teaching software security) I would like to ... be able to compile several kernels with or without features such as: ... The idea is to run these kernels in UML mode in order for the students ...
    (Linux-Kernel)
  • 2.6.15 boot problems
    ... I compiled both kernels by hand, ... memory, then gives me the following message: ... (presumably because of the filesystem). ... A little more on the kernel compile. ...
    (Debian-User)
  • Re: 2.6.15 boot problems
    ... I compiled both kernels by hand, ... no additional filesystems (including /proc ... A little more on the kernel compile. ...
    (Debian-User)