linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kernel: arg2 is unsigned long which is never < 0
@ 2013-02-16  4:13 Chen Gang
  2013-02-16  7:44 ` Kees Cook
  2013-02-16  7:50 ` Cyrill Gorcunov
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Gang @ 2013-02-16  4:13 UTC (permalink / raw)
  To: Cyrill Gorcunov, Andrew Morton, Kees Cook, Serge Hallyn,
	Eric W. Biederman
  Cc: linux-kernel


  arg2 will never < 0, for its type is 'unsigned long'

  so need beautify the relative source code (better to use macros).

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 kernel/sys.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 24d1ef5..eebaf8d 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -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? */
@@ -2027,7 +2028,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;
 			}
-- 
1.7.7.6

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

* Re: [PATCH v2] kernel: arg2 is unsigned long which is never < 0
  2013-02-16  4:13 [PATCH v2] kernel: arg2 is unsigned long which is never < 0 Chen Gang
@ 2013-02-16  7:44 ` Kees Cook
  2013-02-16  7:50 ` Cyrill Gorcunov
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2013-02-16  7:44 UTC (permalink / raw)
  To: Chen Gang
  Cc: Cyrill Gorcunov, Andrew Morton, Serge Hallyn, Eric W. Biederman,
	linux-kernel

On Fri, Feb 15, 2013 at 8:13 PM, Chen Gang <gang.chen@asianux.com> wrote:
>
>   arg2 will never < 0, for its type is 'unsigned long'
>
>   so need beautify the relative source code (better to use macros).
>
> Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Chrome OS Security

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

* Re: [PATCH v2] kernel: arg2 is unsigned long which is never < 0
  2013-02-16  4:13 [PATCH v2] kernel: arg2 is unsigned long which is never < 0 Chen Gang
  2013-02-16  7:44 ` Kees Cook
@ 2013-02-16  7:50 ` Cyrill Gorcunov
  1 sibling, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2013-02-16  7:50 UTC (permalink / raw)
  To: Chen Gang
  Cc: Andrew Morton, Kees Cook, Serge Hallyn, Eric W. Biederman, linux-kernel

On Sat, Feb 16, 2013 at 12:13:41PM +0800, Chen Gang wrote:
> 
>   arg2 will never < 0, for its type is 'unsigned long'
> 
>   so need beautify the relative source code (better to use macros).
> 
> Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>

Looks good to me, thanks Chen!

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

end of thread, other threads:[~2013-02-16  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-16  4:13 [PATCH v2] kernel: arg2 is unsigned long which is never < 0 Chen Gang
2013-02-16  7:44 ` Kees Cook
2013-02-16  7:50 ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).