]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/media/v4l2-core/v4l2-ctrls.c
[media] v4l2-ctrls: fix corner case in round-to-range code
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 18 Jul 2014 08:15:21 +0000 (05:15 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 22 Jul 2014 03:42:32 +0000 (00:42 -0300)
commit958c7c7e65999c61af7da0812d2de12daa8fc29e
tree622f16bad8c727e091290c35c6764fa278a34efb
parent12c78e665f96b3f73dc0b6a6190a4871fe526293
[media] v4l2-ctrls: fix corner case in round-to-range code

If you have a maximum that is at the limit of what the type supports,
and the step is > 1, then you can get wrap-around errors since the
code assumes that the maximum that the type supports is
ctrl->maximum + ctrl->step / 2.

In practice this is always fine, but in artificially crafted ranges
you will hit this bug. Since this is core code it should just work.

This bug has always been there but since it doesn't cause problems in
practice it was never noticed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/v4l2-ctrls.c