]> Git Repo - qemu.git/commit - block/qcow2.c
qcow2: Fix error handling in the compression code
authorAlberto Garcia <[email protected]>
Tue, 30 Apr 2019 10:08:02 +0000 (13:08 +0300)
committerKevin Wolf <[email protected]>
Tue, 30 Apr 2019 13:29:00 +0000 (15:29 +0200)
commite1f4a37a49ebb346d846eddc5cd4ebbb7afd9990
tree5db2121c2bce16bba372269d50dd474501f7944f
parentdb04524f820582ebf1189223b6378de238511da1
qcow2: Fix error handling in the compression code

This patch fixes a few things in the way error codes are handled in
the qcow2 compression code:

a) qcow2_co_pwritev_compressed() expects qcow2_co_compress() to only
   return -1 or -2 on failure, but this is not correct. Since the
   change from qcow2_compress() to qcow2_co_compress() in commit
   ceb029cd6feccf9f7607 the new code can also return -EINVAL (although
   there does not seem to exist any code path that would cause that
   error in the current implementation).

b) -1 and -2 are ad-hoc error codes defined in qcow2_compress().
   This patch replaces them with standard constants from errno.h.

c) Both qcow2_compress() and qcow2_co_do_compress() return a negative
   value on failure, but qcow2_co_pwritev_compressed() stores the
   value in an unsigned data type.

Signed-off-by: Alberto Garcia <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/qcow2.c
This page took 0.031373 seconds and 4 git commands to generate.