* [Qemu-devel] [PATCH v2] tpm_tis: fix format for 64bit variable
@ 2015-03-31 15:05 Stefan Berger
2015-03-31 16:50 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Berger @ 2015-03-31 15:05 UTC (permalink / raw)
To: qemu-trivial; +Cc: qemu-devel, Stefan Berger
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
hw/tpm/tpm_tis.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 815c8ea..3f42982 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -814,7 +814,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
tis->loc[locty].state == TPM_TIS_STATE_COMPLETION) {
/* drop the byte */
} else {
- DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n",
+ DPRINTF("tpm_tis: Data to send to TPM: 0x%08" PRIx64 " (size=%d)\n",
val, size);
if (tis->loc[locty].state == TPM_TIS_STATE_READY) {
tis->loc[locty].state = TPM_TIS_STATE_RECEPTION;
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tpm_tis: fix format for 64bit variable
2015-03-31 15:05 [Qemu-devel] [PATCH v2] tpm_tis: fix format for 64bit variable Stefan Berger
@ 2015-03-31 16:50 ` Eric Blake
2015-03-31 18:03 ` Stefan Berger
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2015-03-31 16:50 UTC (permalink / raw)
To: Stefan Berger, qemu-trivial; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]
On 03/31/2015 09:05 AM, Stefan Berger wrote:
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
> hw/tpm/tpm_tis.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
However;
>
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 815c8ea..3f42982 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -814,7 +814,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
> tis->loc[locty].state == TPM_TIS_STATE_COMPLETION) {
> /* drop the byte */
> } else {
> - DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n",
> + DPRINTF("tpm_tis: Data to send to TPM: 0x%08" PRIx64 " (size=%d)\n",
This caused me to do a double-take (usually, a variable named 'size' is
size_t, in which case %d is wrong; but here it is 'unsigned size').
Also, there is another suspicious DPRINTF earlier in the function; maybe
it's worth a v3? I'm talking about:
DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr,
(uint32_t)val);
but there are some 32-bit platforms where uint32_t is a long, so %x will
cause a compiler warning, as compared to PRIx32. And if you are just
going to cast, why not cast directly to int; on the other hand, if what
you are printing is truly 64-bit, then why not use %016x instead of %08x
(that is, when printing a 64-bit number, having a minimum of 8 0-padded
bytes doesn't make it easy to distinguish a 10-character from
11-character printout, while consistently padding all output to 16
characters makes alignment easier to spot).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tpm_tis: fix format for 64bit variable
2015-03-31 16:50 ` Eric Blake
@ 2015-03-31 18:03 ` Stefan Berger
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Berger @ 2015-03-31 18:03 UTC (permalink / raw)
To: Eric Blake, qemu-trivial; +Cc: qemu-devel
On 03/31/2015 12:50 PM, Eric Blake wrote:
> On 03/31/2015 09:05 AM, Stefan Berger wrote:
>> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> ---
>> hw/tpm/tpm_tis.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> Reviewed-by: Eric Blake <eblake@redhat.com>
Then let me withdraw this one and fix it as you suggested now.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-31 18:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 15:05 [Qemu-devel] [PATCH v2] tpm_tis: fix format for 64bit variable Stefan Berger
2015-03-31 16:50 ` Eric Blake
2015-03-31 18:03 ` Stefan Berger
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.