From: Thomas Gleixner <tglx@linutronix.de>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>, Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: Re: Question on commit dc7109aaa233 ("futex: Validate waiter correctly in futex_proxy_trylock_atomic()")
Date: Tue, 31 Aug 2021 01:29:40 +0200 [thread overview]
Message-ID: <87a6kyfr4r.ffs@tglx> (raw)
In-Reply-To: <CAKXUXMzqmN1dYpbYSCXWN9VwHn8+MXj3P=G09qD6=atwrcJ8WA@mail.gmail.com>
Lukas,
On Fri, Aug 20 2021 at 13:17, Lukas Bulwahn wrote:
> in commit dc7109aaa233 ("futex: Validate waiter correctly in
> futex_proxy_trylock_atomic()") visible on next-20210819, you add:
>
> + /*
> + * Ensure that this is a waiter sitting in futex_wait_requeue_pi()
> + * and waiting on the 'waitqueue' futex which is always !PI.
> + */
> + if (!top_waiter->rt_waiter || top_waiter->pi_state)
> + ret = -EINVAL;
>
> However, ret is unconditionally reassigned later and erases any
> intended effect of this assignment. This is making that assignment
> above a Dead Store, which clang-analyzer correctly warns about and
> which motivates me to write you an email.
>
> Did you intend to return -EINVAL here? So:
>
> + if (!top_waiter->rt_waiter || top_waiter->pi_state)
> + return -EINVAL;
Duh, yes.
> Static analysis tools are as foolish as they are... but every dog has its day...
IOW: Even a blind hen sometimes finds a grain of corn :)
Care to send a patch?
Thanks,
tglx
next prev parent reply other threads:[~2021-08-30 23:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 11:17 Question on commit dc7109aaa233 ("futex: Validate waiter correctly in futex_proxy_trylock_atomic()") Lukas Bulwahn
2021-08-30 23:29 ` Thomas Gleixner [this message]
2021-09-01 18:28 ` André Almeida
2021-09-01 19:19 ` 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=87a6kyfr4r.ffs@tglx \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sudipm.mukherjee@gmail.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;
as well as URLs for NNTP newsgroup(s).