Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4012099ybg; Sun, 7 Jun 2020 18:27:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaI6cGhLJKgLN5m+sWILlnYnewmmLJ/9euAThIckl5lUaiOf1PlR2seoYVy19elW/DpWB5 X-Received: by 2002:a17:906:560b:: with SMTP id f11mr19458876ejq.11.1591579651992; Sun, 07 Jun 2020 18:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591579651; cv=none; d=google.com; s=arc-20160816; b=bsgm3nfLfF+jevcJnQvbyYbkJkWCdFkzxfoe7PZ2sQMC8dh95PWhtBz9C9u1z2jkkj NVVPKzfnmFjNRYJ0SbGOc1eoq1D8567IbF4rf7T3lJMIJ0LK45Uq47dn3ig/fpZttCRW ++4ggEuuwMNpYDLyyqoww8QpK2s2cPqCn2zC8wIhc9kd+Ywb0HI21TSee4+5YHDVqUbo n8MVJvGWeOaRPB5ZW8F3bz6UDn4nkeu+3J1IYLdzx0GxJin9809K6W0yGe/+EeYywhnA YjEooFZNwKgrfi8SG/qtDgGwKGnV6I2SWaplI0jvpB5ldp7NJGQC8zDbxeAWlk3FBKpM gWkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9uQuN2ZI2MgWouBxWI5lDxPESbdkD1TKITQmFqc5xK8=; b=IrHvq4l0RWWXN5UZVNDhiyt8mKZQw/pFy7Q86E0LR8lD4eBAp1pSJnC1dnkDakyOU0 tiUCARo08SeRW/zUng4lb/ReIF/et6JxGkKZo5I6fPxpu1uFJP4OFJidMdTg98xQ60a0 +6RjY+kqa/XL6peLuvzj1YPyz1E7vuhNo/VgdD5sRcgLfkYUDrqUpS2eynecfpoO9EmY +BEtXRwHEWp+hkqp73ZNU9EJjl/CTnUwU7vuRsdXXlrt8BraevTG+EiQX37zY/0iGtk/ 3Kz7Wrlj5uuOe9hK8eU3GE2QYGX2A2BLssFOazEVw36taCNm2chRb8g4YKspFy4Zj/61 efQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UOnCer4o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch5si7465902edb.567.2020.06.07.18.26.55; Sun, 07 Jun 2020 18:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UOnCer4o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbgFHBYb (ORCPT + 99 others); Sun, 7 Jun 2020 21:24:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727972AbgFHBYa (ORCPT ); Sun, 7 Jun 2020 21:24:30 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5CA022075A; Mon, 8 Jun 2020 01:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591579469; bh=gn50bNobrmHJlHOnCq+jCJlXEsdpnCZrGX2MUr/Mdas=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UOnCer4oPdEUY8quGPSMuoFl9pM8KxPTniA1r64IHO9ltJ2OCMiD6P01e+x5Pql4V /lWjSY20BpUiXtNJh5qd6FYRrr4tT4ZAO3OU+2hSz2sbCzp+8lciTj+ZhqTbC4WgUX HltYx06/Z+VckUpiSgWyZLnGCMXyoKPkuyWnpXDM= Date: Sun, 7 Jun 2020 18:24:28 -0700 From: Andrew Morton To: Joe Perches Cc: Yann Collet , Vasily Averin , Gao Xiang , "linux-kernel@vger.kernel.org" , Gao Xiang Subject: Re: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic() Message-Id: <20200607182428.0d9ce5139b9ab4f36eefca1b@linux-foundation.org> In-Reply-To: <3bf931c6ea0cae3e23f3485801986859851b4f04.camel@perches.com> References: <20200606143646.GB10839.ref@hsiangkao-HP-ZHAN-66-Pro-G1> <20200606143646.GB10839@hsiangkao-HP-ZHAN-66-Pro-G1> <330eccf1-6d4b-07dd-4e55-ffe3a179e4b8@virtuozzo.com> <3bf931c6ea0cae3e23f3485801986859851b4f04.camel@perches.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 07 Jun 2020 18:02:44 -0700 Joe Perches 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 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 Cc: Vasily Averin Cc: Gao Xiang Signed-off-by: Andrew Morton --- 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) /* _