Эх сурвалжийг харах

video: driver:: handle NULL value of ctrl

In case, when control id passed by client is 0, ctrl ref will be NULL.
handle such NULL ctrl by returning -EINVAL from driver.

Fix: v4l2-compliance: testSimpleControls: Invalid Control.

Change-Id: Ie7dfe96775dd5fe71a4e467539dd261e4ba9efaf
Signed-off-by: Dikshita Agarwal <[email protected]>
Dikshita Agarwal 4 жил өмнө
parent
commit
167aebba8c

+ 4 - 0
driver/vidc/src/msm_vidc.c

@@ -379,7 +379,11 @@ int msm_vidc_g_ctrl(void *instance, struct v4l2_control *control)
 		rc = msm_vidc_get_control(inst, ctrl);
 		rc = msm_vidc_get_control(inst, ctrl);
 		if (!rc)
 		if (!rc)
 			control->value = ctrl->val;
 			control->value = ctrl->val;
+	} else {
+		i_vpr_e(inst, "%s: invalid control\n", __func__);
+		return -EINVAL;
 	}
 	}
+
 	if (rc)
 	if (rc)
 		i_vpr_e(inst, "%s: failed for control id %#x\n",
 		i_vpr_e(inst, "%s: failed for control id %#x\n",
 			__func__, control->id);
 			__func__, control->id);