[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251118170907.108832-1-ankitkhushwaha.linux@gmail.com>
Date: Tue, 18 Nov 2025 22:38:50 +0530
From: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>,
andrealmeid@...lia.com,
Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Subject: [PATCH v2] selftests/futex: Fix storing address of local variable
In "child_circular_list()" address of local variable ‘lock_struct a’
is assigned to "" 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;
| ^~~~
removing the static keyword of "head" to fix this.
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
---
changelog:
v2:
Added changes suggested by André.
v1: https://lore.kernel.org/all/20251118162619.50586-1-ankitkhushwaha.linux@gmail.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..ef21a7ec9def 100644
--- a/tools/testing/selftests/futex/functional/robust_list.c
+++ b/tools/testing/selftests/futex/functional/robust_list.c
@@ -509,7 +509,7 @@ TEST(test_robust_list_multiple_elements)
static int child_circular_list(void *arg)
{
- static struct robust_list_head head;
+ struct robust_list_head head;
struct lock_struct a, b, c;
int ret;
--
2.51.1
Powered by blists - more mailing lists