All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Chen <alex.chen@huawei.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: <quintela@redhat.com>, <pbonzini@redhat.com>,
	<qemu-trivial@nongnu.org>, <peter.maydell@linaro.org>,
	<qemu-devel@nongnu.org>, <zhang.zhanghailiang@huawei.com>
Subject: Re: [PATCH] display/vmware_vga: Fix bad printf format specifiers
Date: Thu, 19 Nov 2020 17:18:54 +0800	[thread overview]
Message-ID: <5FB6387E.9090407@huawei.com> (raw)
In-Reply-To: <7eca99aa-54c9-de70-cb72-25cd6f805128@redhat.com>

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




WARNING: multiple messages have this Message-ID (diff)
From: Alex Chen <alex.chen@huawei.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: peter.maydell@linaro.org, zhang.zhanghailiang@huawei.com,
	quintela@redhat.com, qemu-trivial@nongnu.org,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [PATCH] display/vmware_vga: Fix bad printf format specifiers
Date: Thu, 19 Nov 2020 17:18:54 +0800	[thread overview]
Message-ID: <5FB6387E.9090407@huawei.com> (raw)
In-Reply-To: <7eca99aa-54c9-de70-cb72-25cd6f805128@redhat.com>

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




  reply	other threads:[~2020-11-19  9:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19  3:01 [PATCH] display/vmware_vga: Fix bad printf format specifiers Alex Chen
2020-11-19  3:01 ` Alex Chen
2020-11-19  6:16 ` Philippe Mathieu-Daudé
2020-11-19  9:18   ` Alex Chen [this message]
2020-11-19  9:18     ` Alex Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5FB6387E.9090407@huawei.com \
    --to=alex.chen@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.