[alsa-devel] [PATCH] ASoC: cs42l52: Fix off-by-one boundary checking for cs42l52_get_clk()

Axel Lin axel.lin at ingics.com
Sun Dec 16 15:10:21 CET 2012


2012/12/16 Axel Lin <axel.lin at ingics.com>

> The caller uses the return value of cs42l52_get_clk as array index,
> the valid array index is 0 .. ARRAY_SIZE(clk_map_table) - 1.
> Thus we need to ensure ret is less than ARRAY_SIZE(clk_map_table).
>

Just check the code again, ret is always less than ARRAY_SIZE -1.
I think what we missed here is the case no rate is matched.

Axel


More information about the Alsa-devel mailing list