소스 검색

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 년 전
부모
커밋
167aebba8c
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      driver/vidc/src/msm_vidc.c

+ 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);
 		if (!rc)
 			control->value = ctrl->val;
+	} else {
+		i_vpr_e(inst, "%s: invalid control\n", __func__);
+		return -EINVAL;
 	}
+
 	if (rc)
 		i_vpr_e(inst, "%s: failed for control id %#x\n",
 			__func__, control->id);