On Sat, Jan 05, 2013 at 02:14:51PM -0500, Nickolai Zeldovich wrote:
> Avoid accessing vc_tbl_ref[3], which is one past the end of that array,
> in da9052_determine_vc_tbl_index(), by adjusting the loop bound.
>
> Signed-off-by: Nickolai Zeldovich <[email protected]>
> ---
Applied, thanks!
> drivers/power/da9052-battery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
> index 3c5c2e4..08193fe 100644
> --- a/drivers/power/da9052-battery.c
> +++ b/drivers/power/da9052-battery.c
> @@ -337,7 +337,7 @@ static unsigned char
> da9052_determine_vc_tbl_index(unsigned char adc_temp)
> if (adc_temp > vc_tbl_ref[DA9052_VC_TBL_REF_SZ - 1])
> return DA9052_VC_TBL_REF_SZ - 1;
>
> - for (i = 0; i < DA9052_VC_TBL_REF_SZ; i++) {
> + for (i = 0; i < DA9052_VC_TBL_REF_SZ - 1; i++) {
> if ((adc_temp > vc_tbl_ref[i]) &&
> (adc_temp <= DA9052_MEAN(vc_tbl_ref[i], vc_tbl_ref[i + 1])))
> return i;
> --
> 1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/