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: <aR7K2bWKiaXrwWIr@smile.fi.intel.com>
Date: Thu, 20 Nov 2025 10:01:29 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: david.laight.linux@...il.com
Cc: linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
	linux-gpio@...r.kernel.org, Bartosz Golaszewski <brgl@...ev.pl>,
	Linus Walleij <linus.walleij@...aro.org>,
	Mika Westerberg <westeri@...nel.org>
Subject: Re: [PATCH 18/44] drivers/gpio: use min() instead of min_t()

On Wed, Nov 19, 2025 at 10:41:14PM +0000, david.laight.linux@...il.com wrote:
> 
> min_t(u16, a, b) casts an 'unsigned long' to 'u16'.
> Use min(a, b) instead as it promotes the both values to int
> and so cannot discard significant bits.
> 
> In this case the values should be ok.
> 
> Detected by an extra check added to min_t().

In most of the patches you need to follow the commonly used Subject prefix.
This can be done by doing

	git log --oneline --no-merges -- $FILE(S)_OF_INTEREST

For example,

$ git log --no-decorate --oneline --no-merges -- drivers/gpio/gpiolib-acpi*
b1055678a016 gpiolib: acpi: Use %pe when passing an error pointer to dev_err()
e4a77f9c85a5 gpiolib: acpi: Make set debounce errors non fatal
19c839a98c73 gpiolib: acpi: initialize acpi_gpio_info struct
3712ce9fa501 gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-05
16c07342b542 gpiolib: acpi: Program debounce when finding GPIO
23800ad1265f gpiolib: acpi: Add quirk for ASUS ProArt PX13
...


> acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,

> -	length = min_t(u16, agpio->pin_table_length, pin_index + bits);
> +	length = min(agpio->pin_table_length, pin_index + bits);

Now, if you look closer at the code, the pin_index alone has the problem you
are targeting here. On top of that the iterator and 'length' are signed, while
the result of min_t(u16) is unsigned (however it has no difference in this case).

...

TL;DR: I apply this patch with subject changed, but I think more work needs to
be done if you want to fix it fully.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ