[media] v4l2-ioctl: add blocks check for VIDIOC_SUBDEV_G/S_EDID
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 2 Oct 2012 05:47:58 +0000 (02:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 7 Oct 2012 13:19:34 +0000 (10:19 -0300)
commit1b8b10cc7e6bd9bf017c58e32b1e7f632e23850d
treef5e97c8bbf2bbc0797088f08d34c6f9cd795f202
parent8a18382c3196978164f0f6290aac98f2f6f43c00
[media] v4l2-ioctl: add blocks check for VIDIOC_SUBDEV_G/S_EDID

The maximum size of an EDID is 32768 bytes, which is 32768 / 128 = 256 blocks.
Return -EINVAL if blocks > 256 to ensure that the memory allocation is sane.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-ioctl.c