aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2010-02-19 12:09:25 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:11:11 -0500
commit84f3751d6a6f766780dee509433bf7b3dfcdf465 (patch)
treec009fded152e598837a0c48af802ef386c77ac60 /drivers
parent4f3ca2f152844c5f6ea853077f56d0db877d1f7a (diff)
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 <baruch@tkos.co.il> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> CC: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/soc_mediabus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c
index 0149290ee5a6..8b63b6545e76 100644
--- a/drivers/media/video/soc_mediabus.c
+++ b/drivers/media/video/soc_mediabus.c
@@ -149,7 +149,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line);
149const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 149const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
150 enum v4l2_mbus_pixelcode code) 150 enum v4l2_mbus_pixelcode code)
151{ 151{
152 if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt)) 152 if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) ||
153 code <= V4L2_MBUS_FMT_FIXED)
153 return NULL; 154 return NULL;
154 return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1; 155 return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1;
155} 156}