msm: camera: sensor: Proper handling of NULL Dereference
- Change to dereference s_ctrl only after proper NULL Dereference Check. - Proper Handling in case of invalid pinctrl index. CIDs Fixed: 50869, 41493 CRs-Fixed: 3715664 Change-Id: If55f7d0854eb4709bd9e93f10bf67318a348a035 Signed-off-by: Abhilash Mahapatra <quic_abhmah@quicinc.com>
This commit is contained in:
@@ -633,8 +633,13 @@ static void cam_res_mgr_gpio_free(struct device *dev, uint gpio)
|
||||
pctrl_idx =
|
||||
cam_res_mgr_util_get_idx_from_shared_pctrl_gpio(
|
||||
gpio);
|
||||
cam_res_mgr_shared_pinctrl_select_state(
|
||||
pctrl_idx, false);
|
||||
if (pctrl_idx >= 0) {
|
||||
cam_res_mgr_shared_pinctrl_select_state(
|
||||
pctrl_idx, false);
|
||||
}
|
||||
else {
|
||||
CAM_ERR(CAM_RES, "Invalid PinCtrl Idx: %d", pctrl_idx);
|
||||
}
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_RES, "freeing gpio: %u", gpio);
|
||||
|
@@ -1065,8 +1065,7 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
{
|
||||
int rc = 0, pkt_opcode = 0;
|
||||
struct cam_control *cmd = (struct cam_control *)arg;
|
||||
struct cam_sensor_power_ctrl_t *power_info =
|
||||
&s_ctrl->sensordata->power_info;
|
||||
struct cam_sensor_power_ctrl_t *power_info = NULL;
|
||||
struct timespec64 ts;
|
||||
uint64_t ms, sec, min, hrs;
|
||||
|
||||
@@ -1075,6 +1074,8 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
power_info = &s_ctrl->sensordata->power_info;
|
||||
|
||||
if (cmd->op_code != CAM_SENSOR_PROBE_CMD) {
|
||||
if (cmd->handle_type != CAM_HANDLE_USER_POINTER) {
|
||||
CAM_ERR(CAM_SENSOR, "Invalid handle type: %d",
|
||||
|
Reference in New Issue
Block a user