Merge "msm: camera: isp: Modify check to avoid NULL dereference" into camera-kernel.lnx.5.0

Dieser Commit ist enthalten in:
Savita Patted
2021-06-29 18:14:39 -07:00
committet von Gerrit - the friendly Code Review server
Commit d1bb5b4eef
3 geänderte Dateien mit 25 neuen und 39 gelöschten Zeilen

Datei anzeigen

@@ -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");

Datei anzeigen

@@ -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))) {

Datei anzeigen

@@ -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))) {