qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 03/10] block: Make bdrv_{pread,pwrite}() return 0 on succe


From: Stefan Hajnoczi
Subject: Re: [PATCH v3 03/10] block: Make bdrv_{pread,pwrite}() return 0 on success
Date: Thu, 26 May 2022 09:49:03 +0100

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 <stefanha@redhat.com>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]