]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/mm: mark more unused arguments with __unused
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Thu, 31 Jul 2025 16:01:31 +0000 (21:01 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 18 Aug 2025 05:08:26 +0000 (22:08 -0700)
Mark the arguments which cannot be removed with __unused attribute.

Link: https://lkml.kernel.org/r/20250731160132.1795351-8-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mariano Pache <npache@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/hugetlb_fault_after_madv.c
tools/testing/selftests/mm/hugetlb_madv_vs_map.c
tools/testing/selftests/mm/pkey-arm64.h
tools/testing/selftests/mm/pkey-powerpc.h
tools/testing/selftests/mm/pkey-x86.h
tools/testing/selftests/mm/pkey_sighandler_tests.c
tools/testing/selftests/mm/protection_keys.c

index e2640529dbb29e58547e02a142c338ed783a4a3c..72706c64fe57c7d3a7542192da59c64b1e47974b 100644 (file)
@@ -28,7 +28,7 @@ static void signal_handler(int signal)
 }
 
 /* Touch the memory while it is being madvised() */
-void *touch(void *unused)
+void *touch(void __unused *unused)
 {
        char *ptr = (char *)huge_ptr;
 
@@ -41,7 +41,7 @@ void *touch(void *unused)
        return NULL;
 }
 
-void *madv(void *unused)
+void *madv(void __unused *unused)
 {
        usleep(rand() % 10);
 
index 8f122a0f0828189379bb54a9faf1db34e765bfc9..64a145594039482c24ddf42fe2b65b82107c348f 100644 (file)
@@ -33,7 +33,7 @@ size_t mmap_size;
 char *huge_ptr;
 
 /* Touch the memory while it is being madvised() */
-void *touch(void *unused)
+void *touch(void __unused *unused)
 {
        for (int i = 0; i < INLOOP_ITER; i++)
                huge_ptr[0] = '.';
@@ -41,7 +41,7 @@ void *touch(void *unused)
        return NULL;
 }
 
-void *madv(void *unused)
+void *madv(void __unused *unused)
 {
        for (int i = 0; i < INLOOP_ITER; i++)
                madvise(huge_ptr, mmap_size, MADV_DONTNEED);
@@ -54,7 +54,7 @@ void *madv(void *unused)
  * The other hugepage should be flipping from used <-> reserved, because
  * of madvise(DONTNEED).
  */
-void *map_extra(void *unused)
+void *map_extra(void __unused *unused)
 {
        void *ptr;
 
index 8e9685e03c441a364c511e51aa1da0b0f0d0f78a..a9cacf3732f60efa349dcc1dc976e302ed7d4b90 100644 (file)
@@ -81,11 +81,12 @@ static inline int get_arch_reserved_keys(void)
        return NR_RESERVED_PKEYS;
 }
 
-static inline void expect_fault_on_read_execonly_key(void *p1, int pkey)
+static inline void expect_fault_on_read_execonly_key(void __unused *p1, int __unused pkey)
 {
 }
 
-static inline void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey)
+static inline void *malloc_pkey_with_mprotect_subpage(long __unused size, int __unused prot,
+                                                     u16 __unused pkey)
 {
        return PTR_ERR_ENOTSUP;
 }
index 17bf2d1b0192e0a3134d2afd04a4af98ed4e0a61..8a367c32a9dd6e7e2a5766f82d4352b32140c4b5 100644 (file)
@@ -93,7 +93,7 @@ static inline int get_arch_reserved_keys(void)
                        return NR_RESERVED_PKEYS_64K_3KEYS;
 }
 
-static inline void expect_fault_on_read_execonly_key(void *p1, int pkey)
+static inline void expect_fault_on_read_execonly_key(void __unused *p1, int __unused pkey)
 {
        /*
         * powerpc does not allow userspace to change permissions of exec-only
index f7ecd335df1e6837aab3fc95c8d996594f0feb5f..27688c04abd35ef6ecd536f21863f1e9b033eac6 100644 (file)
@@ -157,7 +157,8 @@ static inline void expect_fault_on_read_execonly_key(void *p1, int pkey)
        expected_pkey_fault(pkey);
 }
 
-static inline void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey)
+static inline void *malloc_pkey_with_mprotect_subpage(long __unused size, int __unused prot,
+                                                     u16 __unused pkey)
 {
        return PTR_ERR_ENOTSUP;
 }
index eb4ef8532c0bf9683fd2d9f77b81ef9d7541670f..638477494ff3a02e3055cb0681d58cfa796c00c5 100644 (file)
@@ -110,7 +110,7 @@ static inline u64 pkey_reg_restrictive_default(void)
        return set_pkey_bits(PKEY_REG_ALLOW_NONE, 0, PKEY_DISABLE_ACCESS);
 }
 
-static void sigsegv_handler(int signo, siginfo_t *info, void *ucontext)
+static void sigsegv_handler(int __unused signo, siginfo_t *info, void __unused *ucontext)
 {
        pthread_mutex_lock(&mutex);
 
@@ -122,7 +122,7 @@ static void sigsegv_handler(int signo, siginfo_t *info, void *ucontext)
        syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
 }
 
-static void sigusr1_handler(int signo, siginfo_t *info, void *ucontext)
+static void sigusr1_handler(int __unused signo, siginfo_t *info, void __unused *ucontext)
 {
        pthread_mutex_lock(&mutex);
 
@@ -132,7 +132,7 @@ static void sigusr1_handler(int signo, siginfo_t *info, void *ucontext)
        pthread_mutex_unlock(&mutex);
 }
 
-static void sigusr2_handler(int signo, siginfo_t *info, void *ucontext)
+static void sigusr2_handler(int __unused signo, siginfo_t __unused *info, void __unused *ucontext)
 {
        /*
         * pkru should be the init_pkru value which enabled MPK 0 so
@@ -155,7 +155,7 @@ static void raise_sigusr2(void)
         */
 }
 
-static void *thread_segv_with_pkey0_disabled(void *ptr)
+static void *thread_segv_with_pkey0_disabled(void __unused *ptr)
 {
        /* Disable MPK 0 (and all others too) */
        __write_pkey_reg(pkey_reg_restrictive_default());
@@ -165,7 +165,7 @@ static void *thread_segv_with_pkey0_disabled(void *ptr)
        return NULL;
 }
 
-static void *thread_segv_pkuerr_stack(void *ptr)
+static void *thread_segv_pkuerr_stack(void __unused *ptr)
 {
        /* Disable MPK 0 (and all others too) */
        __write_pkey_reg(pkey_reg_restrictive_default());
index 6281d4c61b50e4a5fe0e290fcae07c5c0ddaba0f..65bc9ba59f72be955a04f4d6ef70cc25a414ea16 100644 (file)
@@ -309,7 +309,7 @@ static char *si_code_str(int si_code)
 
 static int pkey_faults;
 static int last_si_pkey = -1;
-static void signal_handler(int signum, siginfo_t *si, void *vucontext)
+static void signal_handler(int __unused signum, siginfo_t *si, void *vucontext)
 {
        ucontext_t *uctxt = vucontext;
        int trapno;
@@ -889,7 +889,7 @@ static void close_test_fds(void)
        nr_test_fds = 0;
 }
 
-static void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 pkey)
+static void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 __unused pkey)
 {
        int i, err;
        int max_nr_pkey_allocs;
@@ -1106,7 +1106,7 @@ static void test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey)
 }
 
 /* Assumes that all pkeys other than 'pkey' are unallocated */
-static void test_pkey_syscalls_bad_args(int *ptr, u16 pkey)
+static void test_pkey_syscalls_bad_args(int *ptr, u16 __unused pkey)
 {
        int err;
        int bad_pkey = NR_PKEYS+99;
@@ -1132,7 +1132,7 @@ static void become_child(void)
 }
 
 /* Assumes that all pkeys other than 'pkey' are unallocated */
-static void test_pkey_alloc_exhaust(int *ptr, u16 pkey)
+static void test_pkey_alloc_exhaust(int __unused *ptr, u16 __unused pkey)
 {
        int err;
        int allocated_pkeys[NR_PKEYS] = {0};
@@ -1238,7 +1238,7 @@ static void arch_force_pkey_reg_init(void)
  * a long-running test that continually checks the pkey
  * register.
  */
-static void test_pkey_init_state(int *ptr, u16 pkey)
+static void test_pkey_init_state(int __unused *ptr, u16 __unused pkey)
 {
        int err;
        int allocated_pkeys[NR_PKEYS] = {0};
@@ -1397,7 +1397,7 @@ static void *get_pointer_to_instructions(void)
        return p1;
 }
 
-static void test_executing_on_unreadable_memory(int *ptr, u16 pkey)
+static void test_executing_on_unreadable_memory(int __unused *ptr, u16 pkey)
 {
        void *p1;
        int scratch;
@@ -1429,7 +1429,7 @@ static void test_executing_on_unreadable_memory(int *ptr, u16 pkey)
        pkey_assert(!ret);
 }
 
-static void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey)
+static void test_implicit_mprotect_exec_only_memory(int __unused *ptr, u16 __unused pkey)
 {
        void *p1;
        int scratch;
@@ -1478,7 +1478,7 @@ static void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey)
 }
 
 #if defined(__i386__) || defined(__x86_64__)
-static void test_ptrace_modifies_pkru(int *ptr, u16 pkey)
+static void test_ptrace_modifies_pkru(int __unused *ptr, u16 __unused pkey)
 {
        u32 new_pkru;
        pid_t child;
@@ -1601,7 +1601,7 @@ static void test_ptrace_modifies_pkru(int *ptr, u16 pkey)
 #endif
 
 #if defined(__aarch64__)
-static void test_ptrace_modifies_pkru(int *ptr, u16 pkey)
+static void test_ptrace_modifies_pkru(int __unused *ptr, u16 __unused pkey)
 {
        pid_t child;
        int status, ret;