Re: [PATCH][RFC] lib: zstd: resolve maybe-uninitialized warning

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

 



Hi Ahmad,

On Wed, Jun 14, 2023 at 10:55 AM Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> wrote:
>
> Hello Yegor,
>
> On 14.06.23 10:09, yegorslists@xxxxxxxxxxxxxx wrote:
> > From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>
> >
> > Perform memset() at the very beginning of the ZSTD_getFrameParams()
> > routine.
>
> I saw this too a while back and I came to the conclusion that this
> is a false positive. I wasn't able to reproduce this with
> GCC 12, but saw it with GCC 11 IIRC.

You're right. I could reproduce it with GCC 10 but not 12. So, the
patch can be dropped.

Yegor

> Cheers,
> Ahmad
>
> >
> > Signed-off-by: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>
> > ---
> >  lib/zstd/decompress.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> > index 19bf712881..78df7d660a 100644
> > --- a/lib/zstd/decompress.c
> > +++ b/lib/zstd/decompress.c
> > @@ -207,6 +207,7 @@ static size_t ZSTD_frameHeaderSize(const void *src, size_t srcSize)
> >  size_t ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t srcSize)
> >  {
> >       const BYTE *ip = (const BYTE *)src;
> > +     memset(fparamsPtr, 0, sizeof(*fparamsPtr));
> >
> >       if (srcSize < ZSTD_frameHeaderSize_prefix)
> >               return ZSTD_frameHeaderSize_prefix;
> > @@ -214,7 +215,6 @@ size_t ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t
> >               if ((ZSTD_readLE32(src) & 0xFFFFFFF0U) == ZSTD_MAGIC_SKIPPABLE_START) {
> >                       if (srcSize < ZSTD_skippableHeaderSize)
> >                               return ZSTD_skippableHeaderSize; /* magic number + skippable frame length */
> > -                     memset(fparamsPtr, 0, sizeof(*fparamsPtr));
> >                       fparamsPtr->frameContentSize = ZSTD_readLE32((const char *)src + 4);
> >                       fparamsPtr->windowSize = 0; /* windowSize==0 means a frame is skippable */
> >                       return 0;
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux