[media] v4l2-ctrls: make manual_mode_value 8 bits and check against control range
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 28 Jun 2011 13:43:13 +0000 (10:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:53:21 +0000 (17:53 -0300)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-ctrls.c
include/media/v4l2-ctrls.h

index d084cea2b3ba77d20c09da21b37873b97e52f88e..1bbaed6a5930c824514856f08596864aff3bd59a 100644 (file)
@@ -1264,6 +1264,7 @@ void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
 
        v4l2_ctrl_cluster(ncontrols, controls);
        WARN_ON(ncontrols <= 1);
+       WARN_ON(manual_val < master->minimum || manual_val > master->maximum);
        master->is_auto = true;
        master->manual_mode_value = manual_val;
        master->flags |= V4L2_CTRL_FLAG_UPDATE;
index de68a59c7d845b318e03ded06b8f3c4c2d578d6e..8f08c6edf5093bf061444e657e0c8307acb467ee 100644 (file)
@@ -118,7 +118,7 @@ struct v4l2_ctrl {
        unsigned int is_private:1;
        unsigned int is_volatile:1;
        unsigned int is_auto:1;
-       unsigned int manual_mode_value:5;
+       unsigned int manual_mode_value:8;
 
        const struct v4l2_ctrl_ops *ops;
        u32 id;