[PATCH v2 2/2] ASoC: cs35l41: Don't hard-code the number of otp_elem in the array

Charles Keepax ckeepax at opensource.cirrus.com
Mon Mar 28 12:17:27 CEST 2022


On Mon, Mar 28, 2022 at 12:22:10PM +0800, Hui Wang wrote:
> The CS35L41_NUM_OTP_ELEM is 100, but only 99 entries are defined in
> the array otp_map_1/2[CS35L41_NUM_OTP_ELEM], this will trigger UBSAN
> to report a shift-out-of-bounds warning in the cs35l41_otp_unpack()
> since the last entry in the array will resuilt in GENMASK(-1, 0).
> 
> To fix it, removing the definition CS35L41_NUM_OTP_ELEM and use
> ARRAY_SIZE to calculate the number of elements dynamically.
> 
> Signed-off-by: Hui Wang <hui.wang at canonical.com>
> ---

Acked-by: Charles Keepax <ckeepax at opensource.cirrus.com>

Thanks,
Charles


More information about the Alsa-devel mailing list