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]
Date:   Sat, 5 Mar 2022 23:26:55 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: fix the size of the ngpios variable

On Sat, Mar 5, 2022 at 10:14 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> The ngpio fields both in struct gpio_device as well as gpio_chip are
> 16 bit unsigned integers. Let's not risk an overflow and use the correct
> size when reading the device property.

...

> -               ret = device_property_read_u32(&gdev->dev, "ngpios", &ngpios);
> +               ret = device_property_read_u16(&gdev->dev, "ngpios", &ngpios);

AFAIU DT format you may not do this. The property is ABI-like and it's
32-bit (BE!). Reading as u16 will bring you 2 MSB (bytes) out of 4
from the 32-bit value.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists