Skip to contentSkip to conversation

selftests/futex: Fix storing address of local variable

PATCH In review Ankit Khushwaha 2 participants 3 messages Nov 18, 2025 – Nov 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
changelog:

v2:
Added changes suggested by André.

v1: https://lore.kernel.org/all/[email protected]/

---
 tools/testing/selftests/futex/functional/robust_list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/futex/functional/robust_list.c +1 -1
index e7d1254e18ca..ef21a7ec9def 100644
@@ -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

#1 lore raw

Hi Ankit,

Em 18/11/2025 14:08, Ankit Khushwaha escreveu:

Quoted 9 lines

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;
       |         ~~~~~~~~~~~~~~~^~~~~~~~~
Quoted 9 lines

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.

This should be "Remove the static..." as noted in the kernel documentation:

"Describe your changes in imperative mood, e.g. “make xyzzy do frotz” instead of “[This patch] makes xyzzy do frotz” or “[I] changed xyzzy to do frotz”, as if you are giving orders to the codebase to change its behaviour."

Please have a look on this page here: https://www.kernel.org/doc/html/latest/process/submitting-patches.html

#2 lore raw

Hi André,

Quoted 3 lines · André Almeida

Hi Ankit,

This should be "Remove the static..." as noted in the kernel documentation:

Thanks for pointing it out. I forgot to change the patch name according the changes. I will send v3 patch with correct patch name.

Quoted 8 lines

"Describe your changes in imperative mood, e.g. “make xyzzy do frotz” instead of “[This patch] makes xyzzy do frotz” or “[I] changed xyzzy to do frotz”, as if you are giving orders to the codebase to change its behaviour."

Please have a look on this page here:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Thanks
-- Ankit