All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v3] selftests/futex: Remove static keyword from 'head'
@ 2026-04-20 17:35 Ankit Khushwaha
  0 siblings, 0 replies; only message in thread
From: Ankit Khushwaha @ 2026-04-20 17:35 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, André Almeida
  Cc: linux-kernel, linux-kselftest, Shuah Khan, Ankit Khushwaha

'head' is defined as 'static struct robust_list_head' that stores the
local variable of 'struct lock_struct a' raising the Wdangling-pointer
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;
      |                                        ^~~~

Since 'head' doesn't need static storge duration, removing the static
keyword of it to fix this.

Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
---
v3: https://lore.kernel.org/all/20251125051333.17934-1-ankitkhushwaha.linux@gmail.com/
Updated the patch name and msg as suggested by André.

v2: https://lore.kernel.org/all/20251118170907.108832-1-ankitkhushwaha.linux@gmail.com/
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.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-20 17:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 17:35 [PATCH RESEND v3] selftests/futex: Remove static keyword from 'head' Ankit Khushwaha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.