msm: camera: isp: Modify check to avoid NULL dereference
Modify cdm ops check in IFE/SFE bus to avoid NULL pointer dereference. CRs-Fixed: 2841729 Change-Id: I45a23d3069a8edc49ed6df4abb7187e81a71717b Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
Цей коміт міститься в:

зафіксовано
Gerrit - the friendly Code Review server

джерело
a5acc9cc9f
коміт
0999770372
@@ -1153,8 +1153,8 @@ static int cam_sfe_bus_rd_config_rm(void *priv, void *cmd_args,
|
||||
sfe_bus_rd_data = (struct cam_sfe_bus_rd_data *)
|
||||
update_buf->res->res_priv;
|
||||
|
||||
if (!sfe_bus_rd_data || !sfe_bus_rd_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Failed! Invalid data");
|
||||
if (!sfe_bus_rd_data) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1255,14 +1255,12 @@ static int cam_sfe_bus_rd_update_rm(void *priv, void *cmd_args,
|
||||
|
||||
sfe_bus_rd_data = (struct cam_sfe_bus_rd_data *)
|
||||
update_buf->res->res_priv;
|
||||
|
||||
cdm_util_ops = sfe_bus_rd_data->cdm_util_ops;
|
||||
|
||||
if (!sfe_bus_rd_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Failed! Invalid data");
|
||||
if (!sfe_bus_rd_data || !sfe_bus_rd_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = sfe_bus_rd_data->cdm_util_ops;
|
||||
CAM_DBG(CAM_SFE, "#of RM: %d scratch_buf_cfg: %s",
|
||||
sfe_bus_rd_data->num_rm,
|
||||
update_buf->use_scratch_cfg ? "true" : "false");
|
||||
|
@@ -2096,14 +2096,12 @@ static int cam_sfe_bus_wr_update_wm(void *priv, void *cmd_args,
|
||||
|
||||
sfe_out_data = (struct cam_sfe_bus_wr_out_data *)
|
||||
update_buf->res->res_priv;
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
|
||||
if (!sfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Failed! Invalid data");
|
||||
if (!sfe_out_data || !sfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
if (update_buf->wm_update->num_buf != sfe_out_data->num_wm) {
|
||||
CAM_ERR(CAM_SFE,
|
||||
"Failed! Invalid number buffers:%d required:%d",
|
||||
@@ -2295,8 +2293,8 @@ static int cam_sfe_bus_wr_config_wm(void *priv, void *cmd_args,
|
||||
sfe_out_data = (struct cam_sfe_bus_wr_out_data *)
|
||||
update_buf->res->res_priv;
|
||||
|
||||
if (!sfe_out_data || !sfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Failed! Invalid data");
|
||||
if (!sfe_out_data) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -2426,12 +2424,12 @@ static int cam_sfe_bus_wr_update_hfr(void *priv, void *cmd_args,
|
||||
sfe_out_data = (struct cam_sfe_bus_wr_out_data *)
|
||||
update_hfr->res->res_priv;
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
if (!sfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Failed! Invalid data");
|
||||
if (!sfe_out_data || !sfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
reg_val_pair = &sfe_out_data->common_data->io_buf_update[0];
|
||||
hfr_cfg = (struct cam_isp_port_hfr_config *)update_hfr->data;
|
||||
|
||||
@@ -2648,16 +2646,12 @@ static int cam_sfe_bus_wr_update_bw_limiter(
|
||||
|
||||
sfe_out_data = (struct cam_sfe_bus_wr_out_data *)
|
||||
wm_config_update->res->res_priv;
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
|
||||
if (!sfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE,
|
||||
"Failed invalid data out_data: %pK cdm_utils_ops: %pK",
|
||||
sfe_out_data, cdm_util_ops);
|
||||
if (!sfe_out_data || !sfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_SFE, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = sfe_out_data->cdm_util_ops;
|
||||
reg_val_pair = &sfe_out_data->common_data->io_buf_update[0];
|
||||
for (i = 0, j = 0; i < sfe_out_data->num_wm; i++) {
|
||||
if (j >= (MAX_REG_VAL_PAIR_SIZE - (MAX_BUF_UPDATE_REG_NUM * 2))) {
|
||||
|
@@ -3002,14 +3002,12 @@ static int cam_vfe_bus_ver3_update_wm(void *priv, void *cmd_args,
|
||||
|
||||
vfe_out_data = (struct cam_vfe_bus_ver3_vfe_out_data *)
|
||||
update_buf->res->res_priv;
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
|
||||
if (!vfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP, "Failed! Invalid data");
|
||||
if (!vfe_out_data || !vfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
if (update_buf->wm_update->num_buf != vfe_out_data->num_wm) {
|
||||
CAM_ERR(CAM_ISP,
|
||||
"Failed! Invalid number buffers:%d required:%d",
|
||||
@@ -3226,12 +3224,12 @@ static int cam_vfe_bus_ver3_update_hfr(void *priv, void *cmd_args,
|
||||
vfe_out_data = (struct cam_vfe_bus_ver3_vfe_out_data *)
|
||||
update_hfr->res->res_priv;
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
if (!vfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP, "Failed! Invalid data");
|
||||
if (!vfe_out_data || !vfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
reg_val_pair = &vfe_out_data->common_data->io_buf_update[0];
|
||||
hfr_cfg = (struct cam_isp_port_hfr_config *)update_hfr->data;
|
||||
|
||||
@@ -3582,16 +3580,12 @@ static int cam_vfe_bus_update_bw_limiter(
|
||||
|
||||
vfe_out_data = (struct cam_vfe_bus_ver3_vfe_out_data *)
|
||||
wm_config_update->res->res_priv;
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
|
||||
if (!vfe_out_data || !cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP,
|
||||
"Failed invalid data out_data: %pK cdm_utils_ops: %pK",
|
||||
vfe_out_data, cdm_util_ops);
|
||||
if (!vfe_out_data || !vfe_out_data->cdm_util_ops) {
|
||||
CAM_ERR(CAM_ISP, "Invalid data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cdm_util_ops = vfe_out_data->cdm_util_ops;
|
||||
reg_val_pair = &vfe_out_data->common_data->io_buf_update[0];
|
||||
for (i = 0, j = 0; i < vfe_out_data->num_wm; i++) {
|
||||
if (j >= (MAX_REG_VAL_PAIR_SIZE - (MAX_BUF_UPDATE_REG_NUM * 2))) {
|
||||
|
Посилання в новій задачі
Заблокувати користувача