[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6kyfr4r.ffs@tglx>
Date: Tue, 31 Aug 2021 01:29:40 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Lukas Bulwahn <lukas.bulwahn@...il.com>,
Ingo Molnar <mingo@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: Re: Question on commit dc7109aaa233 ("futex: Validate waiter
correctly in futex_proxy_trylock_atomic()")
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
Powered by blists - more mailing lists