lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 7 Jun 2020 18:24:28 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Yann Collet <cyan@...com>, Vasily Averin <vvs@...tuozzo.com>,
        Gao Xiang <hsiangkao@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Gao Xiang <xiang@...nel.org>
Subject: Re: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()

On Sun, 07 Jun 2020 18:02:44 -0700 Joe Perches <joe@...ches.com> wrote:

> On Mon, 2020-06-08 at 00:40 +0000, Yann Collet wrote:
> > Hi Vasily
> > 
> > 
> > If I do understand the discussion, the question is about usage of `&` instead of `&&`,
> > and the speculation that it might be an error.
> > 
> > It's not an error. Unfortunately, explaining the reasoning behind this decision is a bit long.
> 
> Likely better to add a comment around the use so that
> another patch like this doesn't get submitted again.
> 
> Perhaps something like:

Yup.


From: Joe Perches <joe@...ches.com>
Subject: lib/lz4/lz4_decompress.c: document deliberate use of `&'

This operation was intentional, but tools such as smatch will warn that it
might not have been.

Link: http://lkml.kernel.org/r/3bf931c6ea0cae3e23f3485801986859851b4f04.camel@perches.com
Cc: Yann Collet <cyan@...com>
Cc: Vasily Averin <vvs@...tuozzo.com>
Cc: Gao Xiang <hsiangkao@....com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---

 lib/lz4/lz4_decompress.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/lib/lz4/lz4_decompress.c~lib-lz4-smatch-warning-in-lz4_decompress_generic
+++ a/lib/lz4/lz4_decompress.c
@@ -141,6 +141,9 @@ static FORCE_INLINE int LZ4_decompress_g
 		 * space in the output for those 18 bytes earlier, upon
 		 * entering the shortcut (in other words, there is a
 		 * combined check for both stages).
+		 *
+		 * The & in the likely() below is intentionally not && so that
+		 * some compilers can produce better parallelized runtime code
 		 */
 		if ((endOnInput ? length != RUN_MASK : length <= 8)
 		   /*
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ