mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/vDSO: fix -Wformat warning in vdso_test_correctness
@ 2020-12-17 16:32 Tobias Klauser
  2020-12-17 18:29 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2020-12-17 16:32 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Vincenzo Frascino, linux-kselftest, linux-kernel

Fix the following -Wformat warnings in vdso_test_correctness.c:

vdso_test_correctness.c: In function ‘test_one_clock_gettime64’:
vdso_test_correctness.c:352:21: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat=]
  352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
      |                 ~~~~^
      |                     |
      |                     long int
      |                 %09lld
  353 |         (unsigned long long)start.tv_sec, start.tv_nsec,
      |                                           ~~~~~~~~~~~~~
      |                                                |
      |                                                long long int
vdso_test_correctness.c:352:32: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=]
  352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
      |                            ~~~~^
      |                                |
      |                                long int
      |                            %09lld
  353 |         (unsigned long long)start.tv_sec, start.tv_nsec,
  354 |         (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
      |                                          ~~~~~~~~~~~~
      |                                              |
      |                                              long long int
vdso_test_correctness.c:352:43: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]

The tv_sec member of __kernel_timespec is long long, both in
uapi/linux/time_types.h and locally in vdso_test_correctness.c.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index 5029ef9b228c..c4aea794725a 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -349,7 +349,7 @@ static void test_one_clock_gettime64(int clock, const char *name)
 		return;
 	}
 
-	printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
+	printf("\t%llu.%09lld %llu.%09lld %llu.%09lld\n",
 	       (unsigned long long)start.tv_sec, start.tv_nsec,
 	       (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
 	       (unsigned long long)end.tv_sec, end.tv_nsec);
-- 
2.29.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/vDSO: fix -Wformat warning in vdso_test_correctness
  2020-12-17 16:32 [PATCH] selftests/vDSO: fix -Wformat warning in vdso_test_correctness Tobias Klauser
@ 2020-12-17 18:29 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2020-12-17 18:29 UTC (permalink / raw)
  To: Tobias Klauser, Shuah Khan
  Cc: Vincenzo Frascino, linux-kselftest, linux-kernel, Shuah Khan

On 12/17/20 9:32 AM, Tobias Klauser wrote:
> Fix the following -Wformat warnings in vdso_test_correctness.c:
> 
> vdso_test_correctness.c: In function ‘test_one_clock_gettime64’:
> vdso_test_correctness.c:352:21: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat=]
>    352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
>        |                 ~~~~^
>        |                     |
>        |                     long int
>        |                 %09lld
>    353 |         (unsigned long long)start.tv_sec, start.tv_nsec,
>        |                                           ~~~~~~~~~~~~~
>        |                                                |
>        |                                                long long int
> vdso_test_correctness.c:352:32: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=]
>    352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
>        |                            ~~~~^
>        |                                |
>        |                                long int
>        |                            %09lld
>    353 |         (unsigned long long)start.tv_sec, start.tv_nsec,
>    354 |         (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
>        |                                          ~~~~~~~~~~~~
>        |                                              |
>        |                                              long long int
> vdso_test_correctness.c:352:43: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]
> 
> The tv_sec member of __kernel_timespec is long long, both in
> uapi/linux/time_types.h and locally in vdso_test_correctness.c.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
>   tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
> index 5029ef9b228c..c4aea794725a 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
> @@ -349,7 +349,7 @@ static void test_one_clock_gettime64(int clock, const char *name)
>   		return;
>   	}
>   
> -	printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
> +	printf("\t%llu.%09lld %llu.%09lld %llu.%09lld\n",
>   	Thanks for the patch.

Thanks for the patch.

Applied to linux-kselftest next

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-17 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 16:32 [PATCH] selftests/vDSO: fix -Wformat warning in vdso_test_correctness Tobias Klauser
2020-12-17 18:29 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®