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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zw_BgyXkyGov4MA1@smile.fi.intel.com>
Date: Wed, 16 Oct 2024 16:37:07 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Ingo Molnar <mingo@...nel.org>, Uros Bizjak <ubizjak@...il.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Cc: Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
	Christoph Lameter <cl@...ux.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v1 1/1] x86/percpu: Cast -1 to argument type when
 comparing in percpu_add_op()

On Thu, Sep 05, 2024 at 08:03:56PM +0300, Andy Shevchenko wrote:
> When percpu_add_op() is used with unsigned argument, it prevents kernel builds
> with clang, `make W=1` and CONFIG_WERROR=y:
> 
> net/ipv4/tcp_output.c:187:3: error: result of comparison of constant -1 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>   187 |                 NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPACKCOMPRESSED,
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   188 |                               tp->compressed_ack);
>       |                               ~~~~~~~~~~~~~~~~~~~
> ...
> arch/x86/include/asm/percpu.h:238:31: note: expanded from macro 'percpu_add_op'
>   238 |                               ((val) == 1 || (val) == -1)) ?            \
>       |                                              ~~~~~ ^  ~~
> 
> Fix this by casting -1 to the type of the parameter and then compare.

Any comments? Or can it be taken in?

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ