linux_dsm_epyc7002/drivers/media/v4l2-core
Maciej Matraszek 3bacc10cd4 [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: b0d3159be9

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>
2014-09-23 16:13:43 -03:00
..
Kconfig [media] vb2: Add videobuf2-dvb support 2014-04-16 18:59:29 -03:00
Makefile [media] vb2: Add videobuf2-dvb support 2014-04-16 18:59:29 -03:00
tuner-core.c [media] tuner-core: use true/false for boolean vars 2014-09-03 17:59:14 -03:00
v4l2-async.c [media] v4l2-async: Don't use dynamic static allocation 2013-11-08 09:45:43 -02:00
v4l2-clk.c [media] V4L2: add v4l2-clock helpers to register and unregister a fixed-rate clock 2013-10-31 04:31:30 -02:00
v4l2-common.c [media] v4l2-common: fix overflow in v4l_bound_align_image() 2014-09-23 16:13:43 -03:00
v4l2-compat-ioctl32.c [media] v4l2-compat-ioctl32: fix sparse warnings 2014-09-03 10:37:25 -03:00
v4l2-ctrls.c [media] v4l: Add camera pan/tilt speed controls 2014-09-21 20:23:39 -03:00
v4l2-dev.c [media] v4l2-dev: don't debug poll unless the debug level > 2 2014-07-17 18:30:36 -03:00
v4l2-device.c [media] v4l: Only get module if it's different than the driver for v4l2_dev 2014-05-13 13:41:44 -03:00
v4l2-dv-timings.c [media] v4l2-dv-timings: only check standards if non-zero 2014-09-21 20:40:33 -03:00
v4l2-event.c [media] v4l: Add source change event 2014-05-23 19:50:40 -03:00
v4l2-fh.c [media] media: v4l2-core: remove the use of V4L2_FL_USE_FH_PRIO flag 2014-07-04 16:14:22 -03:00
v4l2-ioctl.c [media] v4l2-ioctl: fix sparse warnings 2014-09-03 10:29:27 -03:00
v4l2-mem2mem.c [media] v4l2-mem2mem: export v4l2_m2m_try_schedule 2014-07-22 12:06:50 -03:00
v4l2-of.c [media] v4l: of: Support empty port nodes 2014-03-11 09:38:49 -03:00
v4l2-subdev.c [media] v4l: subdev: Extend default link validation to cover field order 2014-08-21 15:25:12 -05:00
videobuf2-core.c [media] videobuf2-core: take mmap_sem before calling __qbuf_userptr 2014-09-21 20:12:49 -03:00
videobuf2-dma-contig.c Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-08-05 16:36:30 -07:00
videobuf2-dma-sg.c [media] videobuf2-dma-sg: Fix NULL pointer dereference BUG 2014-05-23 12:18:23 -03:00
videobuf2-dvb.c [media] vb2: Add videobuf2-dvb support 2014-04-16 18:59:29 -03:00
videobuf2-memops.c [media] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call 2012-11-25 17:20:25 -02:00
videobuf2-vmalloc.c [media] videobuf2: add gfp_flags 2013-03-21 13:17:51 -03:00
videobuf-core.c [media] videobuf: Allow reqbufs(0) to free current buffers 2014-09-21 20:13:41 -03:00
videobuf-dma-contig.c [media] videobuf-dma-contig: fix incorrect argument to vm_iomap_memory() call 2014-05-23 12:54:09 -03:00
videobuf-dma-sg.c [media] vmalloc_sg: off by one in error handling 2014-08-21 15:25:31 -05:00
videobuf-dvb.c [media] v4l: move v4l2 core into a separate directory 2012-08-13 23:02:38 -03:00
videobuf-vmalloc.c [media] Revert "[media] videobuf_vm_{open,close} race fixes" 2014-02-04 06:29:46 -02:00