qcow: Check failure of bdrv_getlength() and bdrv_truncate()
commitd7a753a148d4738eef95a3b193b081a9c905399f
authorEric Blake <eblake@redhat.com>
Wed, 9 Aug 2017 20:38:06 +0000 (9 15:38 -0500)
committerKevin Wolf <kwolf@redhat.com>
Mon, 4 Sep 2017 16:33:00 +0000 (4 18:33 +0200)
tree0ca51f42a2bca13a616270305283a1d375f65403
parent56439e9d55626b65ecb887f1ac3714652555312e
qcow: Check failure of bdrv_getlength() and bdrv_truncate()

Omitting the check for whether bdrv_getlength() and bdrv_truncate()
failed meant that it was theoretically possible to return an
incorrect offset to the caller.  More likely, conditions for either
of these functions to fail would also cause one of our other calls
(such as bdrv_pread() or bdrv_pwrite_sync()) to also fail, but
auditing that we are safe is difficult compared to just patching
things to always forward on the error rather than ignoring it.

Use osdep.h macros instead of open-coded rounding while in the
area.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow.c