Re: [PATCH] regulator: 88pm8607 - fix value range checking foraccessing info->vol_table
From: Mark Brown
Date: Sun Sep 05 2010 - 04:49:19 EST
On Sat, Sep 04, 2010 at 11:10:48PM +0800, Axel Lin wrote:
> In choose_voltage(), we use i as array index of info->vol_table.
> The valid value range for i should be 0 .. ARRAY_SIZE(info->vol_table) - 1.
>
> Take LDO1 as example, ARRAY_SIZE(LDO1_table) is 4, vol_nbits of LDO1 is 2.
> for (i = 0; i < (2 << info->vol_nbits); i++) is equivalent to
> for (i = 0; i < 8; i++)
> which is wrong.
>
> The same value range checking also applies for index in pm8607_list_voltage().
>
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
Acked-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/