mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
V4L/DVB: v4l: soc_camera: fix bound checking of mbus_fmt[] index
When code <= V4L2_MBUS_FMT_FIXED soc_mbus_get_fmtdesc returns a pointer to mbus_fmt[x], where x < 0. Fix this. Signed-off-by: Baruch Siach <[email protected]> Signed-off-by: Guennadi Liakhovetski <[email protected]> CC: [email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
4f3ca2f152
commit
84f3751d6a
1 changed files with 2 additions and 1 deletions
|
|
@ -149,7 +149,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line);
|
|||
const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
|
||||
enum v4l2_mbus_pixelcode code)
|
||||
{
|
||||
if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt))
|
||||
if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) ||
|
||||
code <= V4L2_MBUS_FMT_FIXED)
|
||||
return NULL;
|
||||
return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue