Skip to contentSkip to conversation

media: uvcvideo: Fix menu count handling for userspace XU mappings

git:media_stage/master Mauro Carvalho Chehab 1 participant 1 message Sep 13, 2023

Subsystems (3)
lore
Share & tools
lore

Mauro Carvalho Chehab

author maintainer
#0 lore raw

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: uvcvideo: Fix menu count handling for userspace XU mappings
Author:  Laurent Pinchart <[email protected]>
Date:    Tue Jun 6 18:55:30 2023 +0200

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")
 drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
 	map->menu_names = NULL;
 	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
 	size = xmap->menu_count * sizeof(*map->menu_mapping);
 	map->menu_mapping = kzalloc(size, GFP_KERNEL);