linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "Kees Cook" <kees@kernel.org>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"Will Drewry" <wad@chromium.org>, "Shuah Khan" <shuah@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>, kernel@collabora.com
Subject: [PATCH 03/16] selftests/mm: Fix unused parameter warnings
Date: Thu,  9 Jan 2025 22:38:29 +0500	[thread overview]
Message-ID: <20250109173842.1142376-4-usama.anjum@collabora.com> (raw)
In-Reply-To: <20250109173842.1142376-1-usama.anjum@collabora.com>

Fix unused parameter warnings.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/mm/pkey-x86.h          |  4 +++-
 .../selftests/mm/pkey_sighandler_tests.c       | 17 +++++++++++------
 tools/testing/selftests/mm/protection_keys.c   | 18 ++++++++++--------
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h
index f7ecd335df1e6..75cef8ee00702 100644
--- a/tools/testing/selftests/mm/pkey-x86.h
+++ b/tools/testing/selftests/mm/pkey-x86.h
@@ -157,7 +157,9 @@ 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 __attribute__((unused)) size,
+						      int __attribute__((unused)) prot,
+						      u16 __attribute__((unused)) pkey)
 {
 	return PTR_ERR_ENOTSUP;
 }
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index 249989f8b7a2a..cd46528d6c215 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -42,7 +42,8 @@ static siginfo_t siginfo = {0};
  * which is protected by MPK 0 which we don't have access to.
  */
 static inline __always_inline
-long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5, long a6)
+long syscall_raw(long n, long a1, long a2, long a3, long a4, long a5,
+		 long __attribute__((unused)) a6)
 {
 	unsigned long ret;
 #ifdef __x86_64__
@@ -110,7 +111,8 @@ 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 __attribute__((unused)) signo, siginfo_t *info,
+			    void __attribute__((unused)) *ucontext)
 {
 	pthread_mutex_lock(&mutex);
 
@@ -122,7 +124,8 @@ 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 __attribute__((unused)) signo, siginfo_t *info,
+			    void __attribute__((unused)) *ucontext)
 {
 	pthread_mutex_lock(&mutex);
 
@@ -132,7 +135,9 @@ 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 __attribute__((unused)) signo,
+			    siginfo_t __attribute__((unused)) *info,
+			    void __attribute__((unused)) *ucontext)
 {
 	/*
 	 * pkru should be the init_pkru value which enabled MPK 0 so
@@ -155,7 +160,7 @@ static void raise_sigusr2(void)
 	 */
 }
 
-static void *thread_segv_with_pkey0_disabled(void *ptr)
+static void *thread_segv_with_pkey0_disabled(void __attribute__((unused)) *ptr)
 {
 	/* Disable MPK 0 (and all others too) */
 	__write_pkey_reg(pkey_reg_restrictive_default());
@@ -165,7 +170,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 __attribute__((unused)) *ptr)
 {
 	/* Disable MPK 0 (and all others too) */
 	__write_pkey_reg(pkey_reg_restrictive_default());
diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index a4683f2476f27..3a66798a8e8d6 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -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 __attribute__((unused)) signum, siginfo_t *si, void *vucontext)
 {
 	ucontext_t *uctxt = vucontext;
 	int trapno;
@@ -891,7 +891,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 __attribute__((unused)) pkey)
 {
 	int i, err;
 	int max_nr_pkey_allocs;
@@ -1108,7 +1108,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 __attribute__((unused)) pkey)
 {
 	int err;
 	int bad_pkey = NR_PKEYS+99;
@@ -1134,7 +1134,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 __attribute__((unused)) *ptr, u16 __attribute__((unused)) pkey)
 {
 	int err;
 	int allocated_pkeys[NR_PKEYS] = {0};
@@ -1240,7 +1240,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 __attribute__((unused)) *ptr, u16 __attribute__((unused)) pkey)
 {
 	int err;
 	int allocated_pkeys[NR_PKEYS] = {0};
@@ -1399,7 +1399,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 __attribute__((unused)) *ptr, u16 pkey)
 {
 	void *p1;
 	int scratch;
@@ -1431,7 +1431,8 @@ 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 __attribute__((unused)) *ptr,
+						    u16 __attribute__((unused)) pkey)
 {
 	void *p1;
 	int scratch;
@@ -1480,7 +1481,8 @@ 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 __attribute__((unused)) *ptr,
+				      u16 __attribute__((unused)) pkey)
 {
 	u32 new_pkru;
 	pid_t child;
-- 
2.39.5



  parent reply	other threads:[~2025-01-09 17:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 17:38 [PATCH 00/16] selftest/mm: Remove warnings found by adding compiler flags Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 01/16] selftests/mm: remove argc and argv unused parameters Muhammad Usama Anjum
2025-01-09 17:42   ` Kees Cook
2025-01-09 17:48     ` Muhammad Usama Anjum
2025-01-09 17:50       ` Kees Cook
2025-01-10  0:12         ` Andrew Morton
2025-02-01  7:43           ` Muhammad Usama Anjum
2025-01-10 19:00   ` David Laight
2025-02-01  7:32     ` Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 02/16] selftests/mm: Fix unused parameter warnings Muhammad Usama Anjum
2025-01-09 17:38 ` Muhammad Usama Anjum [this message]
2025-01-09 17:38 ` [PATCH 04/16] selftests/mm: Fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 05/16] selftests/mm: kselftest_harness: Fix warnings Muhammad Usama Anjum
2025-01-15 22:19   ` Mark Brown
2025-01-09 17:38 ` [PATCH 06/16] selftests/mm: cow: remove unused variables and fix type mismatch errors Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 07/16] selftests/mm: hmm-tests: Remove always false expressions Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 08/16] selftests/mm: guard-pages: Fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 09/16] selftests/mm: hugetlb-madvise: fix type mismatch issues Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 10/16] selftests/mm: hugepage-vmemmap: fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 11/16] selftests/mm: hugetlb-read-hwpoison: Fix " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 12/16] selftests/mm: khugepaged: " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 13/16] selftests/mm: protection_keys: Fix variables types " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 14/16] selftests/mm: thuge-gen: Fix type " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 15/16] selftests/mm: uffd-*: Fix all " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 16/16] selftests/mm: Makefile: Add the compiler flags Muhammad Usama Anjum
2025-01-16  5:32 ` [PATCH 00/16] selftest/mm: Remove warnings found by adding " Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250109173842.1142376-4-usama.anjum@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=akpm@linux-foundation.org \
    --cc=jglisse@redhat.com \
    --cc=kees@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox