Re: [PATCH v2 2/2] software node: Fix software_node_get_reference_args() with index -1
From: Andy Shevchenko
Date: Thu Jun 18 2026 - 14:36:16 EST
On Thu, Jun 18, 2026 at 05:20:35PM +0200, Alban Bedel wrote:
> The bounds check for the index passed to
> software_node_get_reference_args() was failing when passed UINT_MAX,
> this in turn would lead to an out of bound access in the property
> array. Fix the bound check to also cover the UINT_MAX case.
...
> - if ((index + 1) * sizeof(*ref) > prop->length)
> + if (index >= prop->length / sizeof(*ref))
It trades multiplication for division (which might be not always
power-of-two).
> return -ENOENT;
--
With Best Regards,
Andy Shevchenko