Skip to content

Commit

Permalink
selftests/mm: ensure non-global pkey symbols are marked static
Browse files Browse the repository at this point in the history
The pkey tests define a whole lot of functions and some global variables. 
A few are truly global (declared in pkey-helpers.h), but the majority are
file-scoped.  Make sure those are labelled static.

Some of the pkey_{access,write}_{allow,deny} helpers are not called, or
only called when building for some architectures.  Mark them
__maybe_unused to suppress compiler warnings.

Link: https://lkml.kernel.org/r/20241209095019.1732120-11-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Keith Lucas <keith.lucas@oracle.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Kevin Brodsky authored and Andrew Morton committed Jan 14, 2025
1 parent f3f5559 commit b0cc298
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 69 deletions.
3 changes: 3 additions & 0 deletions tools/testing/selftests/mm/pkey-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ extern void abort_hooks(void);
#ifndef noinline
# define noinline __attribute__((noinline))
#endif
#ifndef __maybe_unused
# define __maybe_unused __attribute__((__unused__))
#endif

int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
int sys_pkey_free(unsigned long pkey);
Expand Down
6 changes: 3 additions & 3 deletions tools/testing/selftests/mm/pkey_sighandler_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

#define STACK_SIZE PTHREAD_STACK_MIN

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
siginfo_t siginfo = {0};
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static siginfo_t siginfo = {0};

/*
* We need to use inline assembly instead of glibc's syscall because glibc's
Expand Down
Loading

0 comments on commit b0cc298

Please sign in to comment.