summaryrefslogtreecommitdiff
path: root/drivers/media/rc/imon.c
diff options
context:
space:
mode:
authorMaciej Matraszek <m.matraszek@samsung.com>2014-09-15 12:14:48 +0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-23 23:13:43 +0400
commit3bacc10cd4a85bc70bc0b6c001d3bf995c7fe04c (patch)
treeeba9c1053dacf1e0aadd3148d7c0b1e9191394b9 /drivers/media/rc/imon.c
parent43c3ea312c49efa01dc3b6cd5d78dd8bed27f347 (diff)
downloadlinux-3bacc10cd4a85bc70bc0b6c001d3bf995c7fe04c.tar.xz
[media] v4l2-common: fix overflow in v4l_bound_align_image()
Fix clamp_align() used in v4l_bound_align_image() to prevent overflow when passed large value like UINT32_MAX. In the current implementation: clamp_align(UINT32_MAX, 8, 8192, 3) returns 8, because in line: x = (x + (1 << (align - 1))) & mask; x overflows to (-1 + 4) & 0x7 = 3, while expected value is 8192. v4l_bound_align_image() is heavily used in VIDIOC_S_FMT and VIDIOC_SUBDEV_S_FMT ioctls handlers, and documentation of the latter explicitly states that: "The modified format should be as close as possible to the original request." -- http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-subdev-g-fmt.html Thus one would expect, that passing UINT32_MAX as format width and height will result in setting maximum possible resolution for the device. Particularly, when the driver doesn't support VIDIOC_ENUM_FRAMESIZES ioctl, which is common in the codebase. Fixes changeset: b0d3159be9a3 Signed-off-by: Maciej Matraszek <m.matraszek@samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc/imon.c')
0 files changed, 0 insertions, 0 deletions