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:   Mon, 27 Sep 2021 22:37:20 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     Phil Elwell <phil@...pberrypi.com>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Stefan Wahren <stefan.wahren@...e.com>,
        Ojaswin Mujoo <ojaswin98@...il.com>,
        Amarjargal Gundjalam <amarjargal16@...il.com>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" 
        <linux-rpi-kernel@...ts.infradead.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-staging@...ts.linux.dev,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: vc04_services: shut up out-of-range warning

On Mon, Sep 27, 2021 at 3:22 PM Phil Elwell <phil@...pberrypi.com> wrote:
> On 27/09/2021 13:26, Dan Carpenter wrote:
> > On Mon, Sep 27, 2021 at 01:36:56PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@...db.de>
> >>
> >> -    if (num_pages > (SIZE_MAX - sizeof(struct pagelist) -
> >> +    if ((size_t)num_pages > (SIZE_MAX - sizeof(struct pagelist) -
> >>                       sizeof(struct vchiq_pagelist_info)) /
> >>                      (sizeof(u32) + sizeof(pages[0]) +
> >>                       sizeof(struct scatterlist)))
> >
> > The temptation would be to declare "num_pages" as size_t instead of
> > adding this cost.  But then something will complain about the
> > "pagelistinfo->num_pages = num_pages;" assignment because
> > "pagelistinfo->num_pages" is a u32.
> >
> > The next temptation is to change the SIZE_MAX to UINT_MAX.  I didn't
> > do that originally because I can't test this and I was trying not to
> > break things...  We probably still don't want to break things, but maybe
> > there is someone who is more familiar with this who knows if UINT_MAX is
> > okay?
>
> The VPU can't address more than 1GB directly, so UINT_MAX is more than sufficient.

Is there a macro that already defines that 1GB size, or maybe an even smaller
value that makes sense as an upper bound?

         Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ