From: Vasily Averin <vvs@virtuozzo.com>
To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] generic arch_futex_atomic_op_inuser() cleanup
Date: Mon, 15 Jul 2019 13:29:45 +0300 [thread overview]
Message-ID: <3d9eef14-4059-0f8a-e76f-a8a09d730913@virtuozzo.com> (raw)
In-Reply-To: <7b963f9a-21b1-4c6d-3ece-556d018508b4@virtuozzo.com>
Looks like this code is dead and therefore looks strange.
I've found it during manual code review and decided to send patch
to pay your attention to this problem.
Probably it's better to remove this code at all?
On 7/15/19 1:27 PM, Vasily Averin wrote:
> Access to 'op' variable does not require pagefault_disable(),
> 'ret' variable should be initialized before using,
> 'oldval' variable can be replaced by constant.
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> include/asm-generic/futex.h | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
> index 8666fe7f35d7..e9a9655d786d 100644
> --- a/include/asm-generic/futex.h
> +++ b/include/asm-generic/futex.h
> @@ -118,9 +118,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
> static inline int
> arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
> {
> - int oldval = 0, ret;
> -
> - pagefault_disable();
> + int ret = 0;
>
> switch (op) {
> case FUTEX_OP_SET:
> @@ -132,10 +130,8 @@ arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
> ret = -ENOSYS;
> }
>
> - pagefault_enable();
> -
> if (!ret)
> - *oval = oldval;
> + *oval = 0;
>
> return ret;
> }
>
next prev parent reply other threads:[~2019-07-15 10:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 10:27 [PATCH] generic arch_futex_atomic_op_inuser() cleanup Vasily Averin
2019-07-15 10:27 ` Vasily Averin
2019-07-15 10:29 ` Vasily Averin [this message]
2019-07-15 10:29 ` Vasily Averin
2019-07-15 12:06 ` Arnd Bergmann
2019-07-15 12:06 ` Arnd Bergmann
2019-07-15 13:15 ` Thomas Gleixner
2019-07-15 13:15 ` Thomas Gleixner
2019-07-16 6:22 ` [PATCH v2] futex: " Vasily Averin
2019-07-16 6:22 ` Vasily Averin
2019-07-16 12:46 ` Arnd Bergmann
2019-07-16 12:46 ` Arnd Bergmann
2019-07-15 13:13 ` [PATCH] " Thomas Gleixner
2019-07-15 13:13 ` Thomas Gleixner
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=3d9eef14-4059-0f8a-e76f-a8a09d730913@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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