Re: [PATCH] regulator: max77802: Bounds check regulator id against opmode

From: Mark Brown
Date: Sat Jan 28 2023 - 12:19:16 EST


On Fri, 27 Jan 2023 14:52:07 -0800, Kees Cook wrote:
> Explicitly bounds-check the id before accessing the opmode array. Seen
> with GCC 13:
>
> ../drivers/regulator/max77802-regulator.c: In function 'max77802_enable':
> ../drivers/regulator/max77802-regulator.c:217:29: warning: array subscript [0, 41] is outside array bounds of 'unsigned int[42]' [-Warray-bounds=]
> 217 | if (max77802->opmode[id] == MAX77802_OFF_PWRREQ)
> | ~~~~~~~~~~~~~~~~^~~~
> ../drivers/regulator/max77802-regulator.c:62:22: note: while referencing 'opmode'
> 62 | unsigned int opmode[MAX77802_REG_MAX];
> | ^~~~~~
>
> [...]

Applied to

broonie/regulator.git for-next

Thanks!

[1/1] regulator: max77802: Bounds check regulator id against opmode
commit: 4fd8bcec5fd7c0d586206fa2f42bd67b06cdaa7e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark