28 Mar
2022
28 Mar
'22
12:17 p.m.
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@canonical.com
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles