[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 10/12] hw/core/loader: gunzip(): initialize z_stream
From: |
Peter Maydell |
Subject: |
Re: [PATCH 10/12] hw/core/loader: gunzip(): initialize z_stream |
Date: |
Tue, 26 Sep 2023 12:06:44 +0100 |
On Mon, 25 Sept 2023 at 20:41, Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> Coverity signals that variable as being used uninitialized. And really,
> when work with external APIs that's better to zero out the structure,
> where we set some fields by hand.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> hw/core/loader.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index 4b67543046..aa02b27089 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -573,7 +573,7 @@ static void zfree(void *x, void *addr)
>
> ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen)
> {
> - z_stream s;
> + z_stream s = {0};
> ssize_t dstbytes;
> int r, i, flags;
Same remark about using "= {}".
thanks
-- PMM
- Re: [PATCH 05/12] device_tree: qmp_dumpdtb(): stronger assertion, (continued)
[PATCH 06/12] mc146818rtc: rtc_set_time(): initialize tm to zeroes, Vladimir Sementsov-Ogievskiy, 2023/09/25
[PATCH 08/12] block/nvme: nvme_process_completion() fix bound for cid, Vladimir Sementsov-Ogievskiy, 2023/09/25
[PATCH 07/12] pcie_sriov: unregister_vfs(): fix error path, Vladimir Sementsov-Ogievskiy, 2023/09/25
[PATCH 10/12] hw/core/loader: gunzip(): initialize z_stream, Vladimir Sementsov-Ogievskiy, 2023/09/25
- Re: [PATCH 10/12] hw/core/loader: gunzip(): initialize z_stream,
Peter Maydell <=
[PATCH 11/12] hw/core/loader: read_targphys(): add upper bound, Vladimir Sementsov-Ogievskiy, 2023/09/25
[PATCH 12/12] io/channel-socket: qio_channel_socket_flush(): improve msg validation, Vladimir Sementsov-Ogievskiy, 2023/09/25
[PATCH 09/12] kvm-all: introduce limits for name_size and num_desc, Vladimir Sementsov-Ogievskiy, 2023/09/25