Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l2-ioctl: allow all controls if ctrl_class == 0

The check_ext_ctrls() function in v4l2-ioctl.c checks if all controls in the
control array are from the same control class as c->ctrl_class. However,
that check should only be done if c->ctrl_class != 0. A 0 value means
that this restriction does not apply.

So return 1 (OK) if c->ctrl_class == 0.

Found by running v4l2-compliance on the uvc driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
9b239b22 2c9fc463

+2
+2
drivers/media/v4l2-core/v4l2-ioctl.c
··· 901 901 */ 902 902 if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE) 903 903 return 0; 904 + if (c->ctrl_class == 0) 905 + return 1; 904 906 /* Check that all controls are from the same control class. */ 905 907 for (i = 0; i < c->count; i++) { 906 908 if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) {