All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] display/vmware_vga: Fix bad printf format specifiers
@ 2020-11-19  3:01 Alex Chen
  2020-11-19  6:16 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Chen @ 2020-11-19  3:01 UTC (permalink / raw)
  To: quintela, pbonzini
  Cc: alex.chen, qemu-trivial, peter.maydell, qemu-devel, zhang.zhanghailiang

We should use printf format specifier "%u" instead of "%d" for
argument of type "unsigned int".

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/display/vmware_vga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index bef0d7d69a..f93bbe15c2 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -534,7 +534,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
 #endif
         break;
     default:
-        fprintf(stderr, "%s: unhandled bpp %d, using fallback cursor\n",
+        fprintf(stderr, "%s: unhandled bpp %u, using fallback cursor\n",
                 __func__, c->bpp);
         cursor_put(qc);
         qc = cursor_builtin_left_ptr();
-- 
2.19.1



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

* Re: [PATCH] display/vmware_vga: Fix bad printf format specifiers
  2020-11-19  3:01 [PATCH] display/vmware_vga: Fix bad printf format specifiers Alex Chen
@ 2020-11-19  6:16 ` Philippe Mathieu-Daudé
  2020-11-19  9:18   ` Alex Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-19  6:16 UTC (permalink / raw)
  To: Alex Chen, quintela, pbonzini
  Cc: qemu-trivial, peter.maydell, qemu-devel, zhang.zhanghailiang

Hi Alex,

On 11/19/20 4:01 AM, Alex Chen wrote:
> We should use printf format specifier "%u" instead of "%d" for
> argument of type "unsigned int".
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Alex Chen <alex.chen@huawei.com>
> ---
>  hw/display/vmware_vga.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
> index bef0d7d69a..f93bbe15c2 100644
> --- a/hw/display/vmware_vga.c
> +++ b/hw/display/vmware_vga.c
> @@ -534,7 +534,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
>  #endif
>          break;
>      default:
> -        fprintf(stderr, "%s: unhandled bpp %d, using fallback cursor\n",
> +        fprintf(stderr, "%s: unhandled bpp %u, using fallback cursor\n",
>                  __func__, c->bpp);

The format fix is correct, but since you change that line,
"fprintf(stderr)" is old code, nowadays we prefer get rid of it
by using warn_report() in place (see "qemu/error-report.h").

Preferably using warn_report():
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>          cursor_put(qc);
>          qc = cursor_builtin_left_ptr();
> 



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

* Re: [PATCH] display/vmware_vga: Fix bad printf format specifiers
  2020-11-19  6:16 ` Philippe Mathieu-Daudé
@ 2020-11-19  9:18   ` Alex Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Chen @ 2020-11-19  9:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: peter.maydell, zhang.zhanghailiang, quintela, qemu-trivial,
	qemu-devel, pbonzini

Hi Philippe,

On 2020/11/19 14:16, Philippe Mathieu-Daudé wrote:
> Hi Alex,
> 
> On 11/19/20 4:01 AM, Alex Chen wrote:
>> We should use printf format specifier "%u" instead of "%d" for
>> argument of type "unsigned int".
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Alex Chen <alex.chen@huawei.com>
>> ---
>>  hw/display/vmware_vga.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
>> index bef0d7d69a..f93bbe15c2 100644
>> --- a/hw/display/vmware_vga.c
>> +++ b/hw/display/vmware_vga.c
>> @@ -534,7 +534,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
>>  #endif
>>          break;
>>      default:
>> -        fprintf(stderr, "%s: unhandled bpp %d, using fallback cursor\n",
>> +        fprintf(stderr, "%s: unhandled bpp %u, using fallback cursor\n",
>>                  __func__, c->bpp);
> 
> The format fix is correct, but since you change that line,
> "fprintf(stderr)" is old code, nowadays we prefer get rid of it
> by using warn_report() in place (see "qemu/error-report.h").
> 

Thanks for your review, since fprintf() is used elsewhere in vmware_vga.c,
I will send a new patch to replace all fprintf() with warn_report() in vmware_vga.c.
In addition, is there better to use error_report() instead of warn_report() here?

Thanks,
Alex




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

end of thread, other threads:[~2020-11-19  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19  3:01 [PATCH] display/vmware_vga: Fix bad printf format specifiers Alex Chen
2020-11-19  6:16 ` Philippe Mathieu-Daudé
2020-11-19  9:18   ` Alex Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.