summary refs log tree commit diff stats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-09 18:06:14 +0100
committerKevin Wolf <kwolf@redhat.com>2017-07-18 15:14:35 +0200
commit9877860e7bd1e26ee70ab9bb5ebc34c92bf23bf5 (patch)
tree20e16f115b7ed46b3ec356138273fed9551aeb50 /hw/ide/qdev.c
parent27e4cf13030ca5d12bbad12f38a27d35378a5894 (diff)
downloadfocaccia-qemu-9877860e7bd1e26ee70ab9bb5ebc34c92bf23bf5.tar.gz
focaccia-qemu-9877860e7bd1e26ee70ab9bb5ebc34c92bf23bf5.zip
block/vmdk: Report failures in vmdk_read_cid()
The function vmdk_read_cid() can fail if the read on the underlying
block device fails, or if there's a format error in the VMDK file.
However its API doesn't provide a mechanism to report these errors,
and in some cases we were returning a CID of 0 and in some cases a
CID of 0xffffffff, either of which might potentially be valid values.

Change the function to return 0 on success or a negative errno, and
return the CID via a uint32_t* argument. Update the callsites to
handle and propagate the error appropriately.

This fixes in passing a Coverity-spotted issue (CID 1350038) where
we weren't checking the return value from sscanf().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
0 files changed, 0 insertions, 0 deletions