From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, jcody@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH] vhdx: fix g_try_malloc0 thinko
Date: Wed, 12 Nov 2014 11:59:49 +0100 [thread overview]
Message-ID: <1415789989-13489-1-git-send-email-pbonzini@redhat.com> (raw)
Spotted while looking at Coverity reports (though not found by
Coverity itself).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/qcow2-snapshot.c | 2 +-
block/vhdx.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index f52d7fd..27d3bc1 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -465,7 +465,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
BDRVQcowState *s = bs->opaque;
QCowSnapshot *sn;
int i, snapshot_index;
- int cur_l1_bytes, sn_l1_bytes;
+ size_t cur_l1_bytes, sn_l1_bytes;
int ret;
uint64_t *sn_l1_table = NULL;
diff --git a/block/vhdx.c b/block/vhdx.c
index 87c99fc..bd1e403 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1593,7 +1593,7 @@ static int vhdx_create_bat(BlockDriverState *bs, BDRVVHDXState *s,
bdrv_has_zero_init(bs) == 0) {
/* for a fixed file, the default BAT entry is not zero */
s->bat = g_try_malloc0(length);
- if (length && s->bat != NULL) {
+ if (length && s->bat == NULL) {
ret = -ENOMEM;
goto exit;
}
--
2.1.0
next reply other threads:[~2014-11-12 11:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 10:59 Paolo Bonzini [this message]
2014-11-12 11:09 ` [Qemu-devel] [PATCH] vhdx: fix g_try_malloc0 thinko Fam Zheng
2014-11-12 11:14 ` Paolo Bonzini
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=1415789989-13489-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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).