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

Hui Wang hui.wang at canonical.com
Mon Mar 28 13:09:39 CEST 2022


On 3/28/22 16:56, Lucas tanure wrote:
> On 3/28/22 05:22, 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).
> result
>>
>> To fix it, removing the definition CS35L41_NUM_OTP_ELEM and use
>> ARRAY_SIZE to calculate the number of elements dynamically.
> This a plain out-of-bounds access issue, you could just say that.
> And at the end, you could say that UBSAN reported the issue.
>
> Also the title should start with Fix, like:
> "Fix out-of-bounds access in cs35l41_otp_packed_element_t"
>
>>
> Fixes: 6450ef559056 ("ASoC: cs35l41: CS35L41 Boosted Smart Amplifier")
>> Signed-off-by: Hui Wang <hui.wang at canonical.com>
>
> You are missing the Fixes tag.
>
OK, got it, will address all comment.

Thanks.



More information about the Alsa-devel mailing list