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: <20240403154534.GE1363414@ziepe.ca>
Date: Wed, 3 Apr 2024 12:45:34 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Arnd Bergmann <arnd@...nel.org>
Cc: linux-kernel@...r.kernel.org, Leon Romanovsky <leon@...nel.org>,
	Nathan Chancellor <nathan@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Kees Cook <keescook@...omium.org>,
	"Gustavo A. R. Silva" <gustavoars@...nel.org>,
	linux-rdma@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH 7/9] infiniband: uverbs: avoid out-of-range warnings

On Thu, Mar 28, 2024 at 03:30:45PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> clang warns for comparisons that are always true, which is the case
> for these two page size checks on architectures with 64KB pages:
> 
> drivers/infiniband/core/uverbs_ioctl.c:90:39: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>         WARN_ON_ONCE(method_elm->bundle_size > PAGE_SIZE);
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
> include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
>         int __ret_warn_on = !!(condition);                      \
>                                ^~~~~~~~~
> drivers/infiniband/core/uverbs_ioctl.c:621:17: error: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>         if (hdr.length > PAGE_SIZE ||
>             ~~~~~~~~~~ ^ ~~~~~~~~~
> 
> Add a cast to u32 in both cases, so it never warns about this.

But doesn't that hurt the codegen?

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ