[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <078950cf-01d0-42b0-868f-15096afd97e8@igalia.com>
Date: Tue, 18 Nov 2025 13:34:59 -0300
From: André Almeida <andrealmeid@...lia.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Darren Hart <dvhart@...radead.org>, Thomas Gleixner <tglx@...utronix.de>,
Shuah Khan <shuah@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
linux-kselftest@...r.kernel.org, Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH] selftests/futex: Fix storing address of local variable
Em 18/11/2025 13:26, Ankit Khushwaha escreveu:
> In `child_circular_list()` address of local variable ‘struct lock_struct a’
> is assigned to `head.list.next` raising the following warning.
>
> robust_list.c: In function ‘child_circular_list’:
> robust_list.c:522:24: warning: storing the address of local variable ‘a’
> in ‘head.list.next’ [-Wdangling-pointer=]
>
> 522 | head.list.next = &a.list;
> | ~~~~~~~~~~~~~~~^~~~~~~~~
> robust_list.c:513:28: note: ‘a’ declared here
> 513 | struct lock_struct a, b, c;
> | ^
> robust_list.c:512:40: note: ‘head’ declared here
> 512 | static struct robust_list_head head;
> | ^~~~
>
> Defining the value with static keyword to fix this.
>
> Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
> ---
> tools/testing/selftests/futex/functional/robust_list.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/futex/functional/robust_list.c b/tools/testing/selftests/futex/functional/robust_list.c
> index e7d1254e18ca..d1aab1cc5a37 100644
> --- a/tools/testing/selftests/futex/functional/robust_list.c
> +++ b/tools/testing/selftests/futex/functional/robust_list.c
> @@ -510,7 +510,7 @@ TEST(test_robust_list_multiple_elements)
> static int child_circular_list(void *arg)
> {
> static struct robust_list_head head;
> - struct lock_struct a, b, c;
> + static struct lock_struct a, b, c;
I believe that the right fix here would be to drop the static from
`head` declaration, WDYT?
Powered by blists - more mailing lists