kernel: arg2 is unsigned long which is never < 0
PATCH v2 1/1 kernel: arg2 is unsigned long which is never < 0
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 <[email protected]>
Signed-off-by Chen Gang <[email protected]>
--- kernel/sys.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/sys.c +3 -1
@@ -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 ; }
Signature · 1 line
1.7.7.6
Quoted 7 lines · Chen Gang
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 <[email protected]>Signed-off-by Chen Gang <[email protected]>
Acked-by Kees Cook <[email protected]>
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 7 lines · Chen Gang
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 <[email protected]>Signed-off-by Chen Gang <[email protected]>
Looks good to me, thanks Chen!