aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-10-31 10:23:15 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-10-31 10:23:15 -0500
commit3a069ff11b9178a84f560435b2fd22294d839018 (patch)
treea5ffe92f5909b26fc77af69d7f5e05f1e20fe268 /block
parentacba391493badb972db654fa1299052fce0379a3 (diff)
parent3899edf7e4a13439793aaad21a17863a3b9152c2 (diff)
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Diffstat (limited to 'block')
-rw-r--r--block/qed.c7
-rw-r--r--block/vmdk.c3
2 files changed, 5 insertions, 5 deletions
diff --git a/block/qed.c b/block/qed.c
index 2e06992784..d032a4574c 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -388,7 +388,6 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
if (ret < 0) {
return ret;
}
- ret = 0; /* ret should always be 0 or -errno */
qed_header_le_to_cpu(&le_header, &s->header);
if (s->header.magic != QED_MAGIC) {
@@ -1420,8 +1419,10 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs,
memcpy(buffer, &le_header, sizeof(le_header));
buffer_len = sizeof(le_header);
- memcpy(buffer + buffer_len, backing_file, backing_file_len);
- buffer_len += backing_file_len;
+ if (backing_file) {
+ memcpy(buffer + buffer_len, backing_file, backing_file_len);
+ buffer_len += backing_file_len;
+ }
/* Write new header */
ret = bdrv_pwrite_sync(bs->file, 0, buffer, buffer_len);
diff --git a/block/vmdk.c b/block/vmdk.c
index 6be592ffd6..e93828eeae 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -208,7 +208,7 @@ static void vmdk_free_last_extent(BlockDriverState *bs)
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
{
char desc[DESC_SIZE];
- uint32_t cid;
+ uint32_t cid = 0xffffffff;
const char *p_name, *cid_str;
size_t cid_str_size;
BDRVVmdkState *s = bs->opaque;
@@ -1407,7 +1407,6 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
bdrv_delete(bs);
return -EINVAL;
}
- filesize = bdrv_getlength(bs);
parent_cid = vmdk_read_cid(bs, 0);
bdrv_delete(bs);
relative_path(parent_filename, sizeof(parent_filename),