From patchwork Thu Feb 18 06:03:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 80205 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1I64BhA022645 for ; Thu, 18 Feb 2010 06:04:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417Ab0BRGEK (ORCPT ); Thu, 18 Feb 2010 01:04:10 -0500 Received: from tango.tkos.co.il ([62.219.50.35]:42997 "EHLO tango.tkos.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109Ab0BRGEJ (ORCPT ); Thu, 18 Feb 2010 01:04:09 -0500 Received: from localhost.localdomain (93-172-149-11.bb.netvision.net.il [93.172.149.11]) (authenticated bits=0) by tango.tkos.co.il (8.12.11.20060308/8.12.11) with ESMTP id o1I63oqm023349; Thu, 18 Feb 2010 08:03:59 +0200 From: Baruch Siach To: Guennadi Liakhovetski Cc: linux-media@vger.kernel.org, Baruch Siach Subject: [PATCH] v4l: soc_camera: fix bound checking of mbus_fmt[] index Date: Thu, 18 Feb 2010 08:03:33 +0200 Message-Id: X-Mailer: git-send-email 1.6.6.1 X-Virus-Scanned: ClamAV version 0.93.1, clamav-milter version 0.93.1 on tango.tkos.co.il X-Virus-Status: Clean X-Spam-Level: -1.028 () BAYES_00,HELO_LH_LD,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.62 on 62.219.50.35 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Feb 2010 06:04:12 +0000 (UTC) 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);