Skip to content

Commit

Permalink
sys_prctl(): arg2 is unsigned long which is never < 0
Browse files Browse the repository at this point in the history
arg2 will never < 0, for its type is 'unsigned long'

Also, use the provided macros.

Signed-off-by: Chen Gang <[email protected]>
Reported-by: Cyrill Gorcunov <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Chen Gang authored and torvalds committed Feb 22, 2013
1 parent 242260f commit 7fe5e04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <linux/syscalls.h>
#include <linux/kprobes.h>
#include <linux/user_namespace.h>
#include <linux/binfmts.h>

#include <linux/kmsg_dump.h>
/* Move somewhere else to avoid recompiling? */
Expand Down Expand Up @@ -2026,7 +2027,8 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
error = get_dumpable(me->mm);
break;
case PR_SET_DUMPABLE:
if (arg2 < 0 || arg2 > 1) {
if (arg2 != SUID_DUMP_DISABLE &&
arg2 != SUID_DUMP_USER) {
error = -EINVAL;
break;
}
Expand Down

0 comments on commit 7fe5e04

Please sign in to comment.