qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block/vpc: fix uninitialised variable compiler


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] block/vpc: fix uninitialised variable compiler warning
Date: Fri, 21 Jul 2017 16:25:58 +0100

On 21 July 2017 at 09:21, Mark Cave-Ayland
<address@hidden> wrote:
> Since commit cfc87e00 "block/vpc.c: Handle write failures in
> get_image_offset()" older versions of gcc (in this case 4.7) incorrectly
> warn that "ret" can be used uninitialised in vpc_co_pwritev().
>
> Setting ret to 0 at the start of vpc_co_pwritev() prevents the warning
> in gcc 4.7 and enables compilation with -Werror to succeed.
>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> ---
>  block/vpc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/vpc.c b/block/vpc.c
> index 10e6519..574879b 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
> @@ -649,7 +649,7 @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, 
> uint64_t bytes,
>      int64_t image_offset;
>      int64_t n_bytes;
>      int64_t bytes_done = 0;
> -    int ret;
> +    int ret = 0;
>      VHDFooter *footer =  (VHDFooter *) s->footer_buf;
>      QEMUIOVector local_qiov;
>

Thanks; applied to master as a buildfix.

-- PMM



reply via email to

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