Re: [PATCH] regulator: mt6359: Fix UBSAN shift-out-of-bounds

From: Mark Brown
Date: Thu Aug 29 2024 - 07:59:29 EST


On Thu, Aug 29, 2024 at 10:58:07AM +0800, Jian Hui Lee wrote:
> A shift-out-of-bounds will occur as caught by LTP fs:read_all_sys, if
> modeset_mask has not been set for MT6359_LDO_LINEAR regulators.
>
> Example command on MediaTek Genio 1200-EVK:
> # cat /sys/devices/platform/soc/10024000.pwrap/10024000.pwrap\:pmic/regulator/regulator.28/opmode
>
> This patch initializes the member modeset_reg to zero, and checks it
> before any further actions.

It would be better to fix this by not registering any mode operations
for the relevant regulators, that will catch these and any other or
future issues.

Attachment: signature.asc
Description: PGP signature