From: Miles Krause <[email protected]>

The registered robust-list head has static storage but points at three
automatic lock nodes. GCC warns about storing the address of a local
variable in the static head when building the selftest with -Wall.

Give the nodes static storage as well. This keeps every object in the
circular list alive through child exit without changing the list topology.

Signed-off-by: Miles Krause <[email protected]>
---
Built with:

  make -C tools/testing/selftests/futex/functional clean
  make -C tools/testing/selftests/futex/functional robust_list

Tested with:

  tools/testing/selftests/futex/functional/robust_list -t test_circular_list
---
 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 b3fab60181d5..2300253a7e35 100644
--- a/tools/testing/selftests/futex/functional/robust_list.c
+++ b/tools/testing/selftests/futex/functional/robust_list.c
@@ -523,7 +523,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;
        int ret;
 
        ret = set_list(&head);

---
base-commit: 051f5d223dfc1806e216f60e4b29c1bf35f5c2d3
change-id: 20260711-futex-robust-list-static-nodes-7048d7119a05

Best regards,
--  
Miles Krause <[email protected]>



Reply via email to