Peter Maydell 9877860e7b 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>
2017-07-18 15:14:35 +02:00
..
2017-07-18 15:14:35 +02:00
2016-10-07 14:14:06 +02:00
2016-10-07 14:14:06 +02:00
2017-07-18 13:09:51 +01:00
2017-07-14 09:36:40 +01:00
2017-07-11 17:44:57 +02:00
2017-07-14 09:36:40 +01:00
2016-11-25 13:51:30 +01:00
2017-07-17 11:28:15 +08:00
2016-06-07 18:19:24 +03:00
2017-07-17 11:34:11 +08:00
2017-07-17 11:34:11 +08:00
2017-06-20 14:31:31 +02:00
2017-07-14 09:36:40 +01:00
2017-07-17 11:34:20 +08:00
2017-07-17 11:34:20 +08:00
2017-07-17 11:28:15 +08:00
2016-09-23 11:42:52 +08:00
2017-07-17 11:28:15 +08:00
2017-07-17 11:28:15 +08:00