]> git.baikalelectronics.ru Git - kernel.git/commit
[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)
commit213c78eea24110420e7ea328a8ba9f126d0017de
tree622f16bad8c727e091290c35c6764fa278a34efb
parent4c32ac5d4ce8c0c936c482d2190d71712def2b87
[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