Message ID | 20230925194040.68592-11-vsementsov@yandex-team.ru |
---|---|
State | New |
Headers | show |
Series | coverity fixes | expand |
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
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;
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(-)