linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm: Fix -Wformat warnings
@ 2018-10-16 14:13 Andrea Parri
  2018-10-16 14:50 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Parri @ 2018-10-16 14:13 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Paolo Bonzini, linux-kselftest, linux-kernel, Andrea Parri

Fixes the following warnings:

dirty_log_test.c: In function ‘help’:
dirty_log_test.c:216:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
  printf(" -i: specify iteration counts (default: %"PRIu64")\n",
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/test_util.h:18:0,
                 from dirty_log_test.c:16:
/usr/include/inttypes.h:105:34: note: format string is defined here
 # define PRIu64  __PRI64_PREFIX "u"
dirty_log_test.c:218:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
  printf(" -I: specify interval in ms (default: %"PRIu64" ms)\n",
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/test_util.h:18:0,
                 from dirty_log_test.c:16:
/usr/include/inttypes.h:105:34: note: format string is defined here
 # define PRIu64  __PRI64_PREFIX "u"

Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
---
 tools/testing/selftests/kvm/dirty_log_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c
index 0c2cdc105f968..a9c4b5e21d7e7 100644
--- a/tools/testing/selftests/kvm/dirty_log_test.c
+++ b/tools/testing/selftests/kvm/dirty_log_test.c
@@ -31,9 +31,9 @@
 /* How many pages to dirty for each guest loop */
 #define  TEST_PAGES_PER_LOOP            1024
 /* How many host loops to run (one KVM_GET_DIRTY_LOG for each loop) */
-#define  TEST_HOST_LOOP_N               32
+#define  TEST_HOST_LOOP_N               32UL
 /* Interval for each host loop (ms) */
-#define  TEST_HOST_LOOP_INTERVAL        10
+#define  TEST_HOST_LOOP_INTERVAL        10UL
 
 /*
  * Guest variables.  We use these variables to share data between host
-- 
2.17.1


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

* Re: [PATCH] selftests: kvm: Fix -Wformat warnings
  2018-10-16 14:13 [PATCH] selftests: kvm: Fix -Wformat warnings Andrea Parri
@ 2018-10-16 14:50 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2018-10-16 14:50 UTC (permalink / raw)
  To: Andrea Parri; +Cc: Paolo Bonzini, linux-kselftest, linux-kernel, Shuah Khan

On 10/16/2018 08:13 AM, Andrea Parri wrote:
> Fixes the following warnings:
> 
> dirty_log_test.c: In function ‘help’:
> dirty_log_test.c:216:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
>   printf(" -i: specify iteration counts (default: %"PRIu64")\n",
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/test_util.h:18:0,
>                  from dirty_log_test.c:16:
> /usr/include/inttypes.h:105:34: note: format string is defined here
>  # define PRIu64  __PRI64_PREFIX "u"
> dirty_log_test.c:218:9: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
>   printf(" -I: specify interval in ms (default: %"PRIu64" ms)\n",
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/test_util.h:18:0,
>                  from dirty_log_test.c:16:
> /usr/include/inttypes.h:105:34: note: format string is defined here
>  # define PRIu64  __PRI64_PREFIX "u"
> 
> Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
> ---
>  tools/testing/selftests/kvm/dirty_log_test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c
> index 0c2cdc105f968..a9c4b5e21d7e7 100644
> --- a/tools/testing/selftests/kvm/dirty_log_test.c
> +++ b/tools/testing/selftests/kvm/dirty_log_test.c
> @@ -31,9 +31,9 @@
>  /* How many pages to dirty for each guest loop */
>  #define  TEST_PAGES_PER_LOOP            1024
>  /* How many host loops to run (one KVM_GET_DIRTY_LOG for each loop) */
> -#define  TEST_HOST_LOOP_N               32
> +#define  TEST_HOST_LOOP_N               32UL
>  /* Interval for each host loop (ms) */
> -#define  TEST_HOST_LOOP_INTERVAL        10
> +#define  TEST_HOST_LOOP_INTERVAL        10UL
>  
>  /*
>   * Guest variables.  We use these variables to share data between host
> 

Thanks for the patch. Applied to linux-kselftest next for 4.20-rc1

thanks,
-- Shuah

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

end of thread, other threads:[~2018-10-16 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 14:13 [PATCH] selftests: kvm: Fix -Wformat warnings Andrea Parri
2018-10-16 14:50 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).