From 02f4c7a910601c1fa192e1554be2a8bfc707ebea Mon Sep 17 00:00:00 2001 From: Vijay kumar Tumati Date: Tue, 31 Oct 2017 15:14:59 +0530 Subject: [PATCH] msm: camera: Check step position table for NULL pointer Before accessing step position table we need to make sure its valid. Change-Id: I914a51861e982d556039e5ba8510a67cab69fb82 Signed-off-by: Vijay kumar Tumati --- .../platform/msm/camera_v2/sensor/actuator/msm_actuator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c index b1bea12c2cc3..6c01d8f47389 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c +++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c @@ -573,6 +573,11 @@ static int32_t msm_actuator_move_focus( CDBG("called, dir %d, num_steps %d\n", dir, num_steps); + if (a_ctrl->step_position_table == NULL) { + pr_err("Step Position Table is NULL\n"); + return -EINVAL; + } + if ((dest_step_pos == a_ctrl->curr_step_pos) || ((dest_step_pos <= a_ctrl->total_steps) && (a_ctrl->step_position_table[dest_step_pos] ==