msm: vidc: Add check to avoid NULL ptr dereference

v4l2_ctrl_get_name may return NULL that leads to NULL
ptr dereference. So added necessay check to avoid ptr
dereferencing if it is NULL.

Change-Id: If1a4ee8fe22e240b278f31888637d22b81b334e1
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal 2019-07-02 11:33:25 +05:30
parent a705e592b9
commit a57153a3f9

View File

@ -1390,6 +1390,7 @@ static int msm_vidc_op_s_ctrl(struct v4l2_ctrl *ctrl)
int rc = 0;
unsigned int c = 0;
struct msm_vidc_inst *inst;
const char *ctrl_name = NULL;
if (!ctrl) {
dprintk(VIDC_ERR, "%s invalid parameters for ctrl\n", __func__);
@ -1413,9 +1414,12 @@ static int msm_vidc_op_s_ctrl(struct v4l2_ctrl *ctrl)
}
}
}
if (rc)
if (rc) {
ctrl_name = v4l2_ctrl_get_name(ctrl->id);
dprintk(VIDC_ERR, "Failed setting control: Inst = %pK (%s)\n",
inst, v4l2_ctrl_get_name(ctrl->id));
inst, ctrl_name ? ctrl_name : "Invalid ctrl");
}
return rc;
}