Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9ff38cf authored by Rajesh Bondugula's avatar Rajesh Bondugula Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: sensor: Validate destination step position



dest_step_position is sent from userspace and is used in
kernel to calculate the final DAC value.
dest_step_position must be validated against total steps.
Actuator will have an unexpected behavior if lens value is
programed to actuator based on invalid dest_step_position.

CRs-Fixed: 1102580
Change-Id: Idcd97043d3bd583d8577233d446a99d1829a4ee6
Signed-off-by: default avatarRajesh Bondugula <rajeshb@codeaurora.org>
parent 79551c4b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -528,6 +528,12 @@ static int32_t msm_actuator_piezo_move_focus(
		return -EFAULT;
	}

	if (dest_step_position > a_ctrl->total_steps) {
		pr_err("Step pos greater than total steps = %d\n",
			dest_step_position);
		return -EFAULT;
	}

	a_ctrl->i2c_tbl_index = 0;
	a_ctrl->func_tbl->actuator_parse_i2c_params(a_ctrl,
		(num_steps *