msm: camera: cci: Check if cci_info structure pointer is NULL

Though cci_ctrl is not NULL its content is handled by user,
who could set cci_info to NULL. A NULL pointer check is placed
before accessing it to avoid any null pointer derefernce.

CRs-Fixed: 3095084

Change-Id: I6f50d4ba38efd9b5c0eb0d14e3d958ff94c11554
Signed-off-by: Rajat Goel <quic_rajgoe@quicinc.com>
Signed-off-by: Shadul Shaikh <quic_shaduls@quicinc.com>
(cherry picked from commit 81c7a070db15aea8a2d7835a68840ac31f4586fb)
This commit is contained in:
Shadul Shaikh
2022-01-04 15:32:04 +05:30
committed by Sridhar Gujje
parent e383234b62
commit 9bd3915e24

View File

@@ -1990,8 +1990,9 @@ int32_t cam_cci_core_cfg(struct v4l2_subdev *sd,
return -EINVAL;
}
if (!cci_ctrl) {
CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d CCI_CTRL IS NULL", cci_dev->soc_info.index, master);
if (!cci_ctrl || !cci_ctrl->cci_info) {
CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d CCI_CTRL OR CCI_INFO IS NULL",
cci_dev->soc_info.index, master);
return -EINVAL;
}