Re: [PATCH v2] spi: cadence: Fix out-of-bounds array access in cdns_mrvl_xspi_setup_clock()

From: Mark Brown
Date: Mon Mar 31 2025 - 08:16:08 EST


On Fri, Mar 28, 2025 at 09:36:30PM -0700, Josh Poimboeuf wrote:
> If requested_clk > 128, cdns_mrvl_xspi_setup_clock() iterates over the
> entire cdns_mrvl_xspi_clk_div_list array without breaking out early,
> causing 'i' to go beyond the array bounds.

> - while (i < ARRAY_SIZE(cdns_mrvl_xspi_clk_div_list)) {
> + while (i < ARRAY_SIZE(cdns_mrvl_xspi_clk_div_list)-1) {

The usual coding style would be to have spaces around the - here.

Attachment: signature.asc
Description: PGP signature