On Thu, May 19, 2022 at 03:48:33PM +0100, Alberto Faria wrote:
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 5493e6b847..d5a1e8bc43 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -113,7 +113,7 @@ static ssize_t qcow2_crypto_hdr_read_func(QCryptoBlock 
> *block, size_t offset,
>          error_setg_errno(errp, -ret, "Could not read encryption header");
>          return -1;
>      }
> -    return ret;
> +    return buflen;
>  }
>  
>  
> @@ -174,7 +174,7 @@ static ssize_t qcow2_crypto_hdr_write_func(QCryptoBlock 
> *block, size_t offset,
>          error_setg_errno(errp, -ret, "Could not read encryption header");
>          return -1;
>      }
> -    return ret;
> +    return buflen;
>  }

I think block/crypto.c's read_func and write_func could be converted to
0 (success) and -errno (failure) in the same way. Callers don't handle
cases where the return value != buflen or failure.

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to