linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@aol.com>
To: Vasily Averin <vvs@virtuozzo.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Gao Xiang <xiang@kernel.org>
Subject: Re: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()
Date: Sat, 6 Jun 2020 22:36:47 +0800	[thread overview]
Message-ID: <20200606143646.GB10839@hsiangkao-HP-ZHAN-66-Pro-G1> (raw)
In-Reply-To: <e109dba0-eaa8-aa21-3b97-f999c76a72a4@virtuozzo.com>

(I'm not sure whether my email was finally sent out since
 I haven't seen it in lore yet. Resend with my another email...)

On Sat, Jun 06, 2020 at 04:28:02PM +0300, Vasily Averin wrote:
> Found by smatch:
> lib/lz4/lz4_decompress.c:150 LZ4_decompress_generic() warn: maybe use && instead of &
> It was realy incorrectly copied from
> https://github.com/lz4/lz4/commit/45f8603aae389d34c689d3ff7427b314071ccd2c
> line 1431

Simply no.

> 
> Fixes: 2209fda323e2 ("lib/lz4: update LZ4 decompressor module")
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
>  lib/lz4/lz4_decompress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
> index 0c9d3ad..f7f7dca 100644
> --- a/lib/lz4/lz4_decompress.c
> +++ b/lib/lz4/lz4_decompress.c
> @@ -147,7 +147,7 @@ static FORCE_INLINE int LZ4_decompress_generic(
>  		    * strictly "less than" on input, to re-enter
>  		    * the loop with at least one byte
>  		    */
> -		   && likely((endOnInput ? ip < shortiend : 1) &
> +		   && likely((endOnInput ? ip < shortiend : 1) &&

I'd like to say, this is not my mistake (even not an issue).
If you notice the latest LZ4 upstream
https://github.com/lz4/lz4/blob/dev/lib/lz4.c#L1865

Or some related change, the lz4 author Cyan did it on purpose.
https://github.com/lz4/lz4/commit/1a191b3f8d26b50a7c1d41590b529ec308d768cd

I think we could follow the latest LZ4 upstream in order to
avoid further maintainence overhead. That's my own thought
anyway.

Thanks,
Gao Xiang


  reply	other threads:[~2020-06-06 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200606143646.GB10839.ref@hsiangkao-HP-ZHAN-66-Pro-G1>
2020-06-06 13:28 ` [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic() Vasily Averin
2020-06-06 14:36   ` Gao Xiang [this message]
2020-06-06 15:16     ` Vasily Averin
2020-06-08  0:40       ` Yann Collet
2020-06-08  1:02         ` Joe Perches
2020-06-08  1:24           ` Andrew Morton

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=20200606143646.GB10839@hsiangkao-HP-ZHAN-66-Pro-G1 \
    --to=hsiangkao@aol.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vvs@virtuozzo.com \
    --cc=xiang@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).