Skip to contentSkip to conversation

: uvcvideo: fill reserved fields with zero of VIDIOC_QUERYMENU

PATCH In review Németh Márton 2 participants 2 messages Apr 18, 2009 – Apr 20, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : uvcvideo: fill reserved fields with zero of VIDIOC_QUERYMENU

When querying menu items with VIDIOC_QUERYMENU the reserved field is not set to zero as required by V4L2 API revision 0.24 [1]. Add this fill.

The patch was tested with v4l-test 0.11 [2] with CNF7129 webcam found on EeePC 901.

References:
[1] V4L2 API specification, revision 0.24

    http://v4l2spec.bytesex.org/spec/r13317.htm#V4L2-QUERYMENU

[2] v4l-test: Test environment for Video For Linux Two API
http://v4l-test.sourceforge.net/

---

drivers/media/video/uvc/uvc_v4l2.c renamed from drivers/media/video/uvc/uvc_v4l2.c.orig +7 -0
@@ -46,6 +46,8 @@ static int uvc_v4l2_query_menu(struct uv
 	struct uvc_menu_info *menu_info;
 	struct uvc_control_mapping *mapping;
 	struct uvc_control *ctrl;
+	__u32 id;
+	__u32 index;
 
 	ctrl = uvc_find_control(video, query_menu->id, &mapping);
 	if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU)
@@ -54,6 +56,11 @@ static int uvc_v4l2_query_menu(struct uv
 	if (query_menu->index >= mapping->menu_count)
 		return -EINVAL;
 
+	id = query_menu->id;
+	index = query_menu->index;
+	memset(query_menu, 0, sizeof(*query_menu));
+	query_menu->id = id;
+	query_menu->index = index;
 	menu_info = &mapping->menu_info[query_menu->index];
 	strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name);
 	return 0;
#1 lore raw

Hi,

Quoted 7 lines · On Saturday 18 April 2009 16:59:20 Németh Márton wrote:

When querying menu items with VIDIOC_QUERYMENU the reserved field is not set to zero as required by V4L2 API revision 0.24 [1]. Add this fill.

The patch was tested with v4l-test 0.11 [2] with CNF7129 webcam found on EeePC 901.

Quoted 6 lines

References:
[1] V4L2 API specification, revision 0.24

    http://v4l2spec.bytesex.org/spec/r13317.htm#V4L2-QUERYMENU

[2] v4l-test: Test environment for Video For Linux Two API
http://v4l-test.sourceforge.net/

Applied with a small modification (use u32 instead of __u32).

Thanks.

Best regards,

Laurent Pinchart