linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@virtuozzo.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>, Gao Xiang <xiang@kernel.org>
Subject: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()
Date: Sat, 6 Jun 2020 16:28:02 +0300	[thread overview]
Message-ID: <e109dba0-eaa8-aa21-3b97-f999c76a72a4@virtuozzo.com> (raw)

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

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) &&
 			     (op <= shortoend))) {
 			/* Copy the literals */
 			memcpy(op, ip, endOnInput ? 16 : 8);
-- 
1.8.3.1


             reply	other threads:[~2020-06-06 13:29 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 ` Vasily Averin [this message]
2020-06-06 14:36   ` [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic() Gao Xiang
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=e109dba0-eaa8-aa21-3b97-f999c76a72a4@virtuozzo.com \
    --to=vvs@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --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).