qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF
@ 2015-03-31 18:49 Stefan Berger
  2015-03-31 18:49 ` [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking Stefan Berger
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Berger @ 2015-03-31 18:49 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel, Stefan Berger

Cast 64bit variables to int when used in DPRINTF. They only contain
32bit of data.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 815c8ea..cb9c7c8 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -421,7 +421,7 @@ static void tpm_tis_dump_state(void *opaque, hwaddr addr)
 
     for (idx = 0; regs[idx] != 0xfff; idx++) {
         DPRINTF("tpm_tis: 0x%04x : 0x%08x\n", regs[idx],
-                (uint32_t)tpm_tis_mmio_read(opaque, base + regs[idx], 4));
+                (int)tpm_tis_mmio_read(opaque, base + regs[idx], 4));
     }
 
     DPRINTF("tpm_tis: read offset   : %d\n"
@@ -555,7 +555,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
         val >>= shift;
     }
 
-    DPRINTF("tpm_tis:  read.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val);
+    DPRINTF("tpm_tis:  read.%u(%08x) = %08x\n", size, (int)addr, (int)val);
 
     return val;
 }
@@ -578,7 +578,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
     uint16_t len;
     uint32_t mask = (size == 1) ? 0xff : ((size == 2) ? 0xffff : ~0);
 
-    DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val);
+    DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (int)val);
 
     if (locty == 4 && !hw_access) {
         DPRINTF("tpm_tis: Access to locality 4 only allowed from hardware\n");
@@ -815,7 +815,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
             /* drop the byte */
         } else {
             DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n",
-                    val, size);
+                    (int)val, size);
             if (tis->loc[locty].state == TPM_TIS_STATE_READY) {
                 tis->loc[locty].state = TPM_TIS_STATE_RECEPTION;
                 tpm_tis_sts_set(&tis->loc[locty],
-- 
1.9.3

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

* [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking
  2015-03-31 18:49 [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Stefan Berger
@ 2015-03-31 18:49 ` Stefan Berger
  2015-03-31 19:48   ` Eric Blake
  2015-03-31 19:47 ` [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Eric Blake
  2015-04-25  6:15 ` Michael Tokarev
  2 siblings, 1 reply; 5+ messages in thread
From: Stefan Berger @ 2015-03-31 18:49 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel, Stefan Berger

Modify DPRINTF to always enable -Wformat checking.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/tpm/tpm_passthrough.c | 16 +++++++---------
 hw/tpm/tpm_tis.c         | 14 ++++++--------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index 2a45071..73ca906 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -34,15 +34,13 @@
 #include "sysemu/tpm_backend_int.h"
 #include "tpm_tis.h"
 
-/* #define DEBUG_TPM */
-
-#ifdef DEBUG_TPM
-#define DPRINTF(fmt, ...) \
-    do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-    do { } while (0)
-#endif
+#define DEBUG_TPM 0
+
+#define DPRINTF(fmt, ...) do { \
+    if (DEBUG_TPM) { \
+        fprintf(stderr, fmt, ## __VA_ARGS__); \
+    } \
+} while (0);
 
 #define TYPE_TPM_PASSTHROUGH "tpm-passthrough"
 #define TPM_PASSTHROUGH(obj) \
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index cb9c7c8..4b6d601 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -30,15 +30,13 @@
 #include "qemu-common.h"
 #include "qemu/main-loop.h"
 
-/*#define DEBUG_TIS */
+#define DEBUG_TIS 0
 
-#ifdef DEBUG_TIS
-#define DPRINTF(fmt, ...) \
-    do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-    do { } while (0)
-#endif
+#define DPRINTF(fmt, ...) do { \
+    if (DEBUG_TIS) { \
+        printf(fmt, ## __VA_ARGS__); \
+    } \
+} while (0);
 
 /* whether the STS interrupt is supported */
 #define RAISE_STS_IRQ
-- 
1.9.3

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

* Re: [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF
  2015-03-31 18:49 [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Stefan Berger
  2015-03-31 18:49 ` [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking Stefan Berger
@ 2015-03-31 19:47 ` Eric Blake
  2015-04-25  6:15 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2015-03-31 19:47 UTC (permalink / raw)
  To: Stefan Berger, qemu-trivial; +Cc: qemu-devel

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

On 03/31/2015 12:49 PM, Stefan Berger wrote:
> Cast 64bit variables to int when used in DPRINTF. They only contain
> 32bit of data.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
>  hw/tpm/tpm_tis.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

The --cover-letter option is nice when sending a series (so that it
becomes obvious whether I'm replying to the series 0/2 or to an
individual patch 1/2).

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
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] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking
  2015-03-31 18:49 ` [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking Stefan Berger
@ 2015-03-31 19:48   ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2015-03-31 19:48 UTC (permalink / raw)
  To: Stefan Berger, qemu-trivial; +Cc: qemu-devel

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

On 03/31/2015 12:49 PM, Stefan Berger wrote:
> Modify DPRINTF to always enable -Wformat checking.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
>  hw/tpm/tpm_passthrough.c | 16 +++++++---------
>  hw/tpm/tpm_tis.c         | 14 ++++++--------
>  2 files changed, 13 insertions(+), 17 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
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] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF
  2015-03-31 18:49 [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Stefan Berger
  2015-03-31 18:49 ` [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking Stefan Berger
  2015-03-31 19:47 ` [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Eric Blake
@ 2015-04-25  6:15 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2015-04-25  6:15 UTC (permalink / raw)
  To: Stefan Berger, qemu-trivial; +Cc: qemu-devel

Applied both patches to -trivial, thank you!

/mjt

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

end of thread, other threads:[~2015-04-25  6:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 18:49 [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Stefan Berger
2015-03-31 18:49 ` [Qemu-devel] [PATCH 2/2] tpm: Modify DPRINTF to enable -Wformat checking Stefan Berger
2015-03-31 19:48   ` Eric Blake
2015-03-31 19:47 ` [Qemu-devel] [PATCH 1/2] tpm: Cast 64bit variables to int when used in DPRINTF Eric Blake
2015-04-25  6:15 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).