Skip to content
Snippets Groups Projects
Commit 4c7ffa00 authored by Rajesh Bondugula's avatar Rajesh Bondugula Committed by Pat Tjin
Browse files

msm: camera: sensor: Validate i2c_frq_mode in msm_cci_get_clk_rates


i2c_freq_mode in msm_cci_get_clk_rates is populated from userspace.
Validate to make sure it has valid values. If a large number is sent
from userspace to avoid a buffer over read.

Crs-Fixed: 1086833
Change-Id: I237f60dca3e3dbad4e6188bf047cf7ec5163d159
Signed-off-by: default avatarRajesh Bondugula <rajeshb@codeaurora.org>
Bug: 34230377
Signed-off-by: default avatarYueyao Zhu <yueyao@google.com>
parent 6fbef1bf
No related branches found
No related tags found
No related merge requests found
......@@ -749,6 +749,13 @@ static struct msm_cam_clk_info *msm_cci_get_clk(struct cci_device *cci_dev,
struct msm_cci_clk_params_t *clk_params = NULL;
enum i2c_freq_mode_t i2c_freq_mode = c_ctrl->cci_info->i2c_freq_mode;
struct device_node *of_node = cci_dev->pdev->dev.of_node;
if ((i2c_freq_mode >= I2C_MAX_MODES) || (i2c_freq_mode < 0)) {
pr_err("%s:%d invalid i2c_freq_mode %d\n",
__func__, __LINE__, i2c_freq_mode);
return NULL;
}
clk_params = &cci_dev->cci_clk_params[i2c_freq_mode];
cci_clk_src = clk_params->cci_clk_src;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment