* [Qemu-devel] [PATCH] block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot()
@ 2014-04-04 15:09 Kevin Wolf
2014-04-04 15:23 ` Max Reitz
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2014-04-04 15:09 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha, mreitz
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index d89c344..990a754 100644
--- a/block.c
+++ b/block.c
@@ -1184,7 +1184,12 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
instead of opening 'filename' directly */
/* Get the required size from the image */
- total_size = bdrv_getlength(bs) & BDRV_SECTOR_MASK;
+ total_size = bdrv_getlength(bs);
+ if (total_size < 0) {
+ error_setg_errno(errp, -total_size, "Could not get image size");
+ return;
+ }
+ total_size &= BDRV_SECTOR_MASK;
/* Create the temporary image */
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot()
2014-04-04 15:09 [Qemu-devel] [PATCH] block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot() Kevin Wolf
@ 2014-04-04 15:23 ` Max Reitz
0 siblings, 0 replies; 2+ messages in thread
From: Max Reitz @ 2014-04-04 15:23 UTC (permalink / raw)
To: Kevin Wolf, qemu-devel; +Cc: stefanha
On 04.04.2014 17:09, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-04 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-04 15:09 [Qemu-devel] [PATCH] block: Check bdrv_getlength() return value in bdrv_append_temp_snapshot() Kevin Wolf
2014-04-04 15:23 ` Max Reitz
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).