public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Chen Gang <gang.chen@asianux.com>
Cc: akpm@linux-foundation.org, keescook@chromium.org,
	serge.hallyn@canonical.com, ebiederm@xmission.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel: arg2 is unsigned long which is never < 0
Date: Wed, 6 Feb 2013 12:56:53 +0400	[thread overview]
Message-ID: <20130206085653.GQ1712@moon> (raw)
In-Reply-To: <511217F3.6050800@asianux.com>

On Wed, Feb 06, 2013 at 04:44:35PM +0800, Chen Gang wrote:
> 
>   arg2 will never < 0, for its type is 'unsigned long'
> 
>   so delete the waste code.
> 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  kernel/sys.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sys.c b/kernel/sys.c
> index 24d1ef5..568b9ca 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2027,7 +2027,7 @@ 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 > 1) {
>  				error = -EINVAL;
>  				break;
>  			}

I guess

	if (arg2 != SUID_DUMPABLE_DISABLED &&
	    arg2 != SUID_DUMPABLE_ENABLED) {
		error = -EINVAL;
		break;
	}

would be better. Still, current patch looks good to me.

  reply	other threads:[~2013-02-06  8:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  8:44 [PATCH] kernel: arg2 is unsigned long which is never < 0 Chen Gang
2013-02-06  8:56 ` Cyrill Gorcunov [this message]
2013-02-06 10:36   ` Chen Gang
2013-02-06 15:24     ` Serge Hallyn
2013-02-07  1:54       ` Chen Gang
2013-02-06 15:35     ` Cyrill Gorcunov
2013-02-06 19:41     ` Kees Cook
2013-02-07  1:38       ` Chen Gang

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=20130206085653.GQ1712@moon \
    --to=gorcunov@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=gang.chen@asianux.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox