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: <CAFhGd8ojRE3no8K--Nanj5PJz4oO-eG2J8Q_4579pDEEJz8uNw@mail.gmail.com>
Date: Thu, 28 Mar 2024 15:12:49 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: linux-kernel@...r.kernel.org, Jason Gunthorpe <jgg@...pe.ca>, 
	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>, 
	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 7:32 AM Arnd Bergmann <arnd@...nel.org> wrote:
> Add a cast to u32 in both cases, so it never warns about this.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Reviewed-by: Justin Stitt <justinstitt@...gle.com>

> ---
>  drivers/infiniband/core/uverbs_ioctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/core/uverbs_ioctl.c
> index f80da6a67e24..e0cc3ddae71b 100644
> --- a/drivers/infiniband/core/uverbs_ioctl.c
> +++ b/drivers/infiniband/core/uverbs_ioctl.c
> @@ -90,7 +90,7 @@ void uapi_compute_bundle_size(struct uverbs_api_ioctl_method *method_elm,
>                 ALIGN(bundle_size + 256, sizeof(*pbundle->internal_buffer));
>
>         /* Do not want order-2 allocations for this. */
> -       WARN_ON_ONCE(method_elm->bundle_size > PAGE_SIZE);
> +       WARN_ON_ONCE((u32)method_elm->bundle_size > PAGE_SIZE);
>  }
>
>  /**
> @@ -636,7 +636,7 @@ long ib_uverbs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>         if (err)
>                 return -EFAULT;
>
> -       if (hdr.length > PAGE_SIZE ||
> +       if ((u32)hdr.length > PAGE_SIZE ||
>             hdr.length != struct_size(&hdr, attrs, hdr.num_attrs))
>                 return -EINVAL;
>
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ