From: Vasily Averin <vvs@virtuozzo.com>
To: Gao Xiang <hsiangkao@aol.com>, Yann Collet <cyan@fb.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 18:16:23 +0300 [thread overview]
Message-ID: <330eccf1-6d4b-07dd-4e55-ffe3a179e4b8@virtuozzo.com> (raw)
In-Reply-To: <20200606143646.GB10839@hsiangkao-HP-ZHAN-66-Pro-G1>
Dear Yann,
could you please consult us about your lz4 pacth
https://github.com/lz4/lz4/commit/1a191b3f8d26b50a7c1d41590b529ec308d768cd
Please see details below.
Thank you,
Vasily Averin
On 6/6/20 5:36 PM, Gao Xiang wrote:
> 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(-)
>commit 1a191b3f8d26b50a7c1d41590b529ec308d768cd
Author: Yann Collet <cyan@fb.com>
Date: Wed May 2 10:33:12 2018 -0700
simplify shortcut
diff --git a/lib/lz4.c b/lib/lz4.c
index c6f0426..b46910f 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1429,62 +1429,29 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
*/
if ((endOnInput ? length != RUN_MASK : length <= 8) &&
/* strictly "less than" on input, to re-enter the loop with at least one byte */
- likely((endOnInput ? ip < shortiend : 1) && (op <= shortoend)))
+ likely((endOnInput ? ip < shortiend : 1) & (op <= shortoend)))
>
>> 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
For me it looks like typo in patch,
lets ask author of this commit.
> 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
>
next prev parent reply other threads:[~2020-06-06 15:16 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
2020-06-06 15:16 ` Vasily Averin [this message]
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=330eccf1-6d4b-07dd-4e55-ffe3a179e4b8@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=cyan@fb.com \
--cc=hsiangkao@aol.com \
--cc=linux-kernel@vger.kernel.org \
--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).