media: ov7740: avoid invalid framesize setting
authorAkinobu Mita <akinobu.mita@gmail.com>
Wed, 17 Apr 2019 14:06:39 +0000 (10:06 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:00 +0000 (09:14 +0200)
commitadd712b63185608ed961d8d58656164a89288d6f
treeb11ddfcee3e195b0106aca50d77cdf7d490742ac
parentb0e199e13495fb20c5c9764b6049648e87e2a64d
media: ov7740: avoid invalid framesize setting

[ Upstream commit 6e4ab830ac6d6a0d7cd7f87dc5d6536369bf24a8 ]

If the requested framesize by VIDIOC_SUBDEV_S_FMT is larger than supported
framesizes, it causes an out of bounds array access and the resulting
framesize is unexpected.

Avoid out of bounds array access and select the default framesize.

Cc: Wenyou Yang <wenyou.yang@microchip.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/ov7740.c