[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190724191448.4db70a34f8b89bd8bdc085f5@linux-foundation.org>
Date: Wed, 24 Jul 2019 19:14:48 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yang Xu <xuyang2018.jy@...fujitsu.com>
Cc: <gorcunov@...il.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] sys_prctl(): remove unsigned comparision with less
than zero
On Wed, 24 Jul 2019 10:11:48 +0800 Yang Xu <xuyang2018.jy@...fujitsu.com> wrote:
> Currently, when calling prctl(PR_SET_TIMERSLACK, arg2), arg2 is an
> unsigned long value, arg2 will never < 0. Negative judgment is
> meaningless, so remove it.
>
> ...
>
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2372,7 +2372,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> error = current->timer_slack_ns;
> break;
> case PR_SET_TIMERSLACK:
> - if (arg2 <= 0)
> + if (arg2 == 0)
> current->timer_slack_ns =
> current->default_timer_slack_ns;
A number of years ago Linus expressed approval of such comparisons with
unsigned quantities. He felt that it improves readability a little -
the reader doesn't have to scroll back and check the type.
Powered by blists - more mailing lists