diff mbox

v4l: soc_camera: fix bound checking of mbus_fmt[] index

Message ID f9972846401291b8619792d11869510e856ee202.1266472904.git.baruch@tkos.co.il (mailing list archive)
State Superseded
Headers show

Commit Message

Baruch Siach Feb. 18, 2010, 6:03 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c
index f8d5c87..a2808e2 100644
--- a/drivers/media/video/soc_mediabus.c
+++ b/drivers/media/video/soc_mediabus.c
@@ -136,6 +136,8 @@  const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
 {
 	if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt))
 		return NULL;
+	if ((unsigned int)code <= V4L2_MBUS_FMT_FIXED)
+		return NULL;
 	return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1;
 }
 EXPORT_SYMBOL(soc_mbus_get_fmtdesc);