From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fix format string warnings in block-qcow2.c
Date: Sat, 28 Mar 2009 19:48:53 +0100 [thread overview]
Message-ID: <20090328184853.GA26111@lst.de> (raw)
Recent patches added two compiler warnings about the format string
usage in qcow_read_extensions. One is printing a uint64_t using
%lu which is incorrect on many platforms as it can be a unsigned
long long, the second one is printing the result of sizeof as
%lu, but it is a size_t so it needs to be printed using %zu.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu/block-qcow2.c
===================================================================
--- qemu.orig/block-qcow2.c 2009-03-28 19:43:58.494882416 +0100
+++ qemu/block-qcow2.c 2009-03-28 19:48:02.766981793 +0100
@@ -223,8 +223,8 @@ static int qcow_read_extensions(BlockDri
#endif
if (bdrv_pread(s->hd, offset, &ext, sizeof(ext)) != sizeof(ext)) {
- fprintf(stderr, "qcow_handle_extension: ERROR: pread fail from offset %lu\n",
- offset);
+ fprintf(stderr, "qcow_handle_extension: ERROR: pread fail from offset %llu\n",
+ (unsigned long long)offset);
return 1;
}
be32_to_cpus(&ext.magic);
@@ -240,7 +240,7 @@ static int qcow_read_extensions(BlockDri
case QCOW_EXT_MAGIC_BACKING_FORMAT:
if (ext.len >= sizeof(bs->backing_format)) {
fprintf(stderr, "ERROR: ext_backing_format: len=%u too large"
- " (>=%lu)\n",
+ " (>=%zu)\n",
ext.len, sizeof(bs->backing_format));
return 2;
}
next reply other threads:[~2009-03-28 18:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-28 18:48 Christoph Hellwig [this message]
2009-03-29 1:32 ` [Qemu-devel] [PATCH] fix format string warnings in block-qcow2.c Anthony Liguori
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=20090328184853.GA26111@lst.de \
--to=hch@lst.de \
--cc=qemu-devel@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 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).