From a8ad5085a205016728c853e139080c6615f1b3fe Mon Sep 17 00:00:00 2001 From: Sakshi Agrawal Date: Wed, 9 Jan 2013 10:41:28 -0700 Subject: [PATCH] msm: kgsl: Lower bounds check the number of power levels A misconfigured board file could cause an out-of-bounds array access through this value. Change-Id: I64bbad0c096a2efe65376991537d810141370d72 CRs-Fixed: 439230 Signed-off-by: Lucille Sylvester Signed-off-by: Sakshi Agrawal --- drivers/gpu/msm/kgsl_pwrctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c index 3b9b689cbf53..b6b024ec6a68 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.c +++ b/drivers/gpu/msm/kgsl_pwrctrl.c @@ -878,7 +878,8 @@ int kgsl_pwrctrl_init(struct kgsl_device *device) if (pdata->set_grp_async != NULL) pdata->set_grp_async(); - if (pdata->num_levels > KGSL_MAX_PWRLEVELS) { + if (pdata->num_levels > KGSL_MAX_PWRLEVELS || + pdata->num_levels < 1) { KGSL_PWR_ERR(device, "invalid power level count: %d\n", pdata->num_levels); result = -EINVAL;