Commit 8a4e76c1 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

V4L/DVB: uvcvideo: Return -ERANGE when setting a control to an out-of-range menu index

The V4L2 specification states that out of bounds control values must
either be clamped to the valid range or result in a -ERANGE error code.

Fix the driver to return -ERANGE instead of -EINVAL when setting a menu
control to an invalid value.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 36bd883e
...@@ -1006,7 +1006,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, ...@@ -1006,7 +1006,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) { if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
if (value < 0 || value >= mapping->menu_count) if (value < 0 || value >= mapping->menu_count)
return -EINVAL; return -ERANGE;
value = mapping->menu_info[value].value; value = mapping->menu_info[value].value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment