selftests/pidfd: Fix ksft print formats
[ Upstream commit 4d7f4e8158b62f63031510cdc24acc520956c091 ]
Compiling pidfd selftest after adding a __printf() attribute to
ksft_print_msg() and ksft_test_result_pass() exposes -Wformat warnings
in error_report(), test_pidfd_poll_exec_thread(),
child_poll_exec_test(), test_pidfd_poll_leader_exit_thread(),
child_poll_leader_exit_test().
The ksft_test_result_pass() in error_report() expects a string but
doesn't provide any argument after the format string. All the other
calls to ksft_print_msg() in the functions mentioned above have format
strings that don't match with other passed arguments.
Fix format specifiers so they match the passed variables.
Add a missing variable to ksft_test_result_pass() inside
error_report() so it matches other cases in the switch statement.
Fixes: 2def297ec7
("pidfd: add tests for NSpid info in fdinfo")
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a0846b4c8e
commit
b3768f0892
@@ -62,7 +62,7 @@ static void error_report(struct error *err, const char *test_name)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PIDFD_PASS:
|
case PIDFD_PASS:
|
||||||
ksft_test_result_pass("%s test: Passed\n");
|
ksft_test_result_pass("%s test: Passed\n", test_name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@@ -380,13 +380,13 @@ static int test_pidfd_send_signal_syscall_support(void)
|
|||||||
|
|
||||||
static void *test_pidfd_poll_exec_thread(void *priv)
|
static void *test_pidfd_poll_exec_thread(void *priv)
|
||||||
{
|
{
|
||||||
ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n",
|
ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n",
|
||||||
getpid(), syscall(SYS_gettid));
|
getpid(), syscall(SYS_gettid));
|
||||||
ksft_print_msg("Child Thread: doing exec of sleep\n");
|
ksft_print_msg("Child Thread: doing exec of sleep\n");
|
||||||
|
|
||||||
execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL);
|
execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL);
|
||||||
|
|
||||||
ksft_print_msg("Child Thread: DONE. pid %d tid %d\n",
|
ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n",
|
||||||
getpid(), syscall(SYS_gettid));
|
getpid(), syscall(SYS_gettid));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ static int child_poll_exec_test(void *args)
|
|||||||
{
|
{
|
||||||
pthread_t t1;
|
pthread_t t1;
|
||||||
|
|
||||||
ksft_print_msg("Child (pidfd): starting. pid %d tid %d\n", getpid(),
|
ksft_print_msg("Child (pidfd): starting. pid %d tid %ld\n", getpid(),
|
||||||
syscall(SYS_gettid));
|
syscall(SYS_gettid));
|
||||||
pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL);
|
pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL);
|
||||||
/*
|
/*
|
||||||
@@ -477,10 +477,10 @@ static void test_pidfd_poll_exec(int use_waitpid)
|
|||||||
|
|
||||||
static void *test_pidfd_poll_leader_exit_thread(void *priv)
|
static void *test_pidfd_poll_leader_exit_thread(void *priv)
|
||||||
{
|
{
|
||||||
ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n",
|
ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n",
|
||||||
getpid(), syscall(SYS_gettid));
|
getpid(), syscall(SYS_gettid));
|
||||||
sleep(CHILD_THREAD_MIN_WAIT);
|
sleep(CHILD_THREAD_MIN_WAIT);
|
||||||
ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", getpid(), syscall(SYS_gettid));
|
ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ static int child_poll_leader_exit_test(void *args)
|
|||||||
{
|
{
|
||||||
pthread_t t1, t2;
|
pthread_t t1, t2;
|
||||||
|
|
||||||
ksft_print_msg("Child: starting. pid %d tid %d\n", getpid(), syscall(SYS_gettid));
|
ksft_print_msg("Child: starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid));
|
||||||
pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL);
|
pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL);
|
||||||
pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL);
|
pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user