2015-07-20 22:48:40

by Darren Hart

[permalink] [raw]
Subject: [PATCH] selftests/futex: Fix futex_cmp_requeue_pi() error handling

An earlier (pre-kernel-integration) refactoring of this code mistakenly
replaced the error condition, <, with a >. Use < to detect an error as
opposed to a successful requeue or signal race.

Reported-by: David Binderman <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Darren Hart <[email protected]>
---
.../selftests/futex/functional/futex_requeue_pi_signal_restart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c b/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
index 7f0c756..3d7dc6a 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
if (res > 0) {
atomic_set(&requeued, 1);
break;
- } else if (res > 0) {
+ } else if (res < 0) {
error("FUTEX_CMP_REQUEUE_PI failed\n", errno);
ret = RET_ERROR;
break;
--
2.1.4


--
Darren Hart
Intel Open Source Technology Center


2015-07-21 00:34:07

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH] selftests/futex: Fix futex_cmp_requeue_pi() error handling

On 07/20/2015 04:48 PM, Darren Hart wrote:
> An earlier (pre-kernel-integration) refactoring of this code mistakenly
> replaced the error condition, <, with a >. Use < to detect an error as
> opposed to a successful requeue or signal race.
>
> Reported-by: David Binderman <[email protected]>
> Cc: Shuah Khan <[email protected]>
> Signed-off-by: Darren Hart <[email protected]>
> ---
> .../selftests/futex/functional/futex_requeue_pi_signal_restart.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c b/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
> index 7f0c756..3d7dc6a 100644
> --- a/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
> +++ b/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
> @@ -191,7 +191,7 @@ int main(int argc, char *argv[])
> if (res > 0) {
> atomic_set(&requeued, 1);
> break;
> - } else if (res > 0) {
> + } else if (res < 0) {
> error("FUTEX_CMP_REQUEUE_PI failed\n", errno);
> ret = RET_ERROR;
> break;
>

Daren,

That is quick. Applied to linux-kselftest fixes for 4.2

thanks,
-- Shuah

--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978