mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: yegorslists@googlemail.com, barebox@lists.infradead.org
Subject: Re: [PATCH][RFC] lib: zstd: resolve maybe-uninitialized warning
Date: Wed, 14 Jun 2023 10:55:29 +0200	[thread overview]
Message-ID: <833c4f35-2fe1-ede5-a305-d2d600c84e8b@pengutronix.de> (raw)
In-Reply-To: <20230614080919.1716578-1-yegorslists@googlemail.com>

Hello Yegor,

On 14.06.23 10:09, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> 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.

Cheers,
Ahmad

> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  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 |




  parent reply	other threads:[~2023-06-14  8:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14  8:09 yegorslists
2023-06-14  8:10 ` Yegor Yefremov
2023-06-14  8:55 ` Ahmad Fatoum [this message]
2023-06-14  9:11   ` Yegor Yefremov
2023-06-14  9:16     ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=833c4f35-2fe1-ede5-a305-d2d600c84e8b@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox