diff mbox

[v2,for-2.10,4/4] block/vhdx: check error return of bdrv_truncate()

Message ID e6f9362b49ae3837a0b20171cc2223aef2aa2e9a.1502109078.git.jcody@redhat.com
State New
Headers show

Commit Message

Jeff Cody Aug. 7, 2017, 12:38 p.m. UTC
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 block/vhdx-log.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Eric Blake Aug. 7, 2017, 12:55 p.m. UTC | #1
On 08/07/2017 07:38 AM, Jeff Cody wrote:
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  block/vhdx-log.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/block/vhdx-log.c b/block/vhdx-log.c
> index a27dc05..14b724e 100644
> --- a/block/vhdx-log.c
> +++ b/block/vhdx-log.c
> @@ -558,7 +558,11 @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
>                      ret = -EINVAL;
>                      goto exit;
>                  }
> -                bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL);
> +                ret = bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF,
> +                                    NULL);
> +                if (ret < 0) {
> +                    goto exit;
> +                }
>              }
>          }
>          qemu_vfree(desc_entries);
>
diff mbox

Patch

diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index a27dc05..14b724e 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -558,7 +558,11 @@  static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
                     ret = -EINVAL;
                     goto exit;
                 }
-                bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL);
+                ret = bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF,
+                                    NULL);
+                if (ret < 0) {
+                    goto exit;
+                }
             }
         }
         qemu_vfree(desc_entries);