[PATCH] tools/virtio:Fix the wrong format specifier

Zhu Jun posted 1 patch 1 year, 6 months ago
tools/virtio/ringtest/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tools/virtio:Fix the wrong format specifier
Posted by Zhu Jun 1 year, 6 months ago
The unsigned int should use "%u" instead of "%d".

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 tools/virtio/ringtest/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
index 5a18b2301a63..e471d8e7cfaa 100644
--- a/tools/virtio/ringtest/main.c
+++ b/tools/virtio/ringtest/main.c
@@ -276,7 +276,7 @@ static void help(void)
 	fprintf(stderr, "Usage: <test> [--help]"
 		" [--host-affinity H]"
 		" [--guest-affinity G]"
-		" [--ring-size R (default: %d)]"
+		" [--ring-size R (default: %u)]"
 		" [--run-cycles C (default: %d)]"
 		" [--batch b]"
 		" [--outstanding o]"
-- 
2.17.1
Re: [PATCH] tools/virtio:Fix the wrong format specifier
Posted by Xuan Zhuo 1 year, 6 months ago
On Wed, 24 Jul 2024 00:41:08 -0700, Zhu Jun <zhujun2@cmss.chinamobile.com> wrote:
> The unsigned int should use "%u" instead of "%d".
>
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>

Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>


> ---
>  tools/virtio/ringtest/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
> index 5a18b2301a63..e471d8e7cfaa 100644
> --- a/tools/virtio/ringtest/main.c
> +++ b/tools/virtio/ringtest/main.c
> @@ -276,7 +276,7 @@ static void help(void)
>  	fprintf(stderr, "Usage: <test> [--help]"
>  		" [--host-affinity H]"
>  		" [--guest-affinity G]"
> -		" [--ring-size R (default: %d)]"
> +		" [--ring-size R (default: %u)]"
>  		" [--run-cycles C (default: %d)]"
>  		" [--batch b]"
>  		" [--outstanding o]"
> --
> 2.17.1
>
>
>
Re: [PATCH] tools/virtio:Fix the wrong format specifier
Posted by Michael S. Tsirkin 1 year, 6 months ago
On Wed, Jul 24, 2024 at 12:41:08AM -0700, Zhu Jun wrote:
> The unsigned int should use "%u" instead of "%d".
> 
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>

which matters why?

> ---
>  tools/virtio/ringtest/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
> index 5a18b2301a63..e471d8e7cfaa 100644
> --- a/tools/virtio/ringtest/main.c
> +++ b/tools/virtio/ringtest/main.c
> @@ -276,7 +276,7 @@ static void help(void)
>  	fprintf(stderr, "Usage: <test> [--help]"
>  		" [--host-affinity H]"
>  		" [--guest-affinity G]"
> -		" [--ring-size R (default: %d)]"
> +		" [--ring-size R (default: %u)]"
>  		" [--run-cycles C (default: %d)]"
>  		" [--batch b]"
>  		" [--outstanding o]"
> -- 
> 2.17.1
> 
>
Re: [PATCH] tools/virtio:Fix the wrong format specifier
Posted by Eugenio Perez Martin 1 year, 6 months ago
On Wed, Jul 24, 2024 at 9:44 AM Zhu Jun <zhujun2@cmss.chinamobile.com> wrote:
>
> The unsigned int should use "%u" instead of "%d".
>
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>

Reviewed-by: Eugenio Pérez <eperezma@redhat.com>

Thanks!

> ---
>  tools/virtio/ringtest/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
> index 5a18b2301a63..e471d8e7cfaa 100644
> --- a/tools/virtio/ringtest/main.c
> +++ b/tools/virtio/ringtest/main.c
> @@ -276,7 +276,7 @@ static void help(void)
>         fprintf(stderr, "Usage: <test> [--help]"
>                 " [--host-affinity H]"
>                 " [--guest-affinity G]"
> -               " [--ring-size R (default: %d)]"
> +               " [--ring-size R (default: %u)]"
>                 " [--run-cycles C (default: %d)]"
>                 " [--batch b]"
>                 " [--outstanding o]"
> --
> 2.17.1
>
>
>