All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] scsi-disk: Use (unsigned long) typecasts when using "%lu" format string
Date: Mon, 13 Jun 2016 18:00:49 +0200	[thread overview]
Message-ID: <575ED8B1.10207@redhat.com> (raw)
In-Reply-To: <575ED0F2.2080900@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

On 13.06.2016 17:27, Eric Blake wrote:
> On 06/13/2016 02:10 AM, Thomas Huth wrote:
>> Some source code analyzers like cppcheck spill out a warning if
>> the sign of the argument does not match the format string.
>>
>> Ticket: https://bugs.launchpad.net/qemu/+bug/1589564
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  hw/scsi/scsi-disk.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>> index 1881969..36f8a85 100644
>> --- a/hw/scsi/scsi-disk.c
>> +++ b/hw/scsi/scsi-disk.c
>> @@ -2060,13 +2060,13 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
>>          }
>>          break;
>>      case MODE_SELECT:
>> -        DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer);
>> +        DPRINTF("Mode Select(6) (len %lu)\n", (unsigned long)r->req.cmd.xfer);
> 
> Why do we need a cast in the first place?  r->req.cmd.xfer is size_t, so
> why not just "Mode Select(6) (len %zu)\n", r->req.cmd.xfer)?

That sounds good, too. Do you want to provide a patch, or shall I do a
v2 of my patch?

 Thomas



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] scsi-disk: Use (unsigned long) typecasts when using "%lu" format string
Date: Mon, 13 Jun 2016 18:00:49 +0200	[thread overview]
Message-ID: <575ED8B1.10207@redhat.com> (raw)
In-Reply-To: <575ED0F2.2080900@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

On 13.06.2016 17:27, Eric Blake wrote:
> On 06/13/2016 02:10 AM, Thomas Huth wrote:
>> Some source code analyzers like cppcheck spill out a warning if
>> the sign of the argument does not match the format string.
>>
>> Ticket: https://bugs.launchpad.net/qemu/+bug/1589564
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  hw/scsi/scsi-disk.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>> index 1881969..36f8a85 100644
>> --- a/hw/scsi/scsi-disk.c
>> +++ b/hw/scsi/scsi-disk.c
>> @@ -2060,13 +2060,13 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
>>          }
>>          break;
>>      case MODE_SELECT:
>> -        DPRINTF("Mode Select(6) (len %lu)\n", (long)r->req.cmd.xfer);
>> +        DPRINTF("Mode Select(6) (len %lu)\n", (unsigned long)r->req.cmd.xfer);
> 
> Why do we need a cast in the first place?  r->req.cmd.xfer is size_t, so
> why not just "Mode Select(6) (len %zu)\n", r->req.cmd.xfer)?

That sounds good, too. Do you want to provide a patch, or shall I do a
v2 of my patch?

 Thomas



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-06-13 16:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  8:10 [Qemu-trivial] [PATCH] scsi-disk: Use (unsigned long) typecasts when using "%lu" format string Thomas Huth
2016-06-13  8:10 ` [Qemu-devel] " Thomas Huth
2016-06-13 10:03 ` [Qemu-trivial] " Paolo Bonzini
2016-06-13 10:03   ` [Qemu-devel] " Paolo Bonzini
2016-06-13 15:27 ` [Qemu-trivial] " Eric Blake
2016-06-13 15:27   ` Eric Blake
2016-06-13 16:00   ` Thomas Huth [this message]
2016-06-13 16:00     ` Thomas Huth
2016-06-13 16:04     ` [Qemu-trivial] " Eric Blake
2016-06-13 16:04       ` Eric Blake

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=575ED8B1.10207@redhat.com \
    --to=thuth@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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.