diff options
author | Fam Zheng <famz@redhat.com> | 2014-04-29 18:14:17 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-04-29 13:43:08 +0200 |
commit | c3cc95bd155d51fc1f9b7259b3bff20a361a1cca (patch) | |
tree | 6986f4b0090614b4b7c4ddc38fc806def663203d /block/mirror.c | |
parent | 373df5b135b4a54e0abb394e9e703fef3ded093c (diff) |
mirror: Check for bdrv_get_info result
bdrv_get_info could fail. Add check before using the returned value.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r-- | block/mirror.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/mirror.c b/block/mirror.c index 403714c1ea..1c38aa8f77 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -339,7 +339,10 @@ static void coroutine_fn mirror_run(void *opaque) bdrv_get_backing_filename(s->target, backing_filename, sizeof(backing_filename)); if (backing_filename[0] && !s->target->backing_hd) { - bdrv_get_info(s->target, &bdi); + ret = bdrv_get_info(s->target, &bdi); + if (ret < 0) { + goto immediate_exit; + } if (s->granularity < bdi.cluster_size) { s->buf_size = MAX(s->buf_size, bdi.cluster_size); s->cow_bitmap = bitmap_new(length); |