From patchwork Fri Feb 19 17:26:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 80757 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 o1JHPwlt014156 for ; Fri, 19 Feb 2010 17:25:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754918Ab0BSRZ4 (ORCPT ); Fri, 19 Feb 2010 12:25:56 -0500 Received: from mail.gmx.net ([213.165.64.20]:40924 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754634Ab0BSRZz (ORCPT ); Fri, 19 Feb 2010 12:25:55 -0500 Received: (qmail invoked by alias); 19 Feb 2010 17:25:53 -0000 Received: from p57BD1B7A.dip0.t-ipconnect.de (EHLO axis700.grange) [87.189.27.122] by mail.gmx.net (mp070) with SMTP; 19 Feb 2010 18:25:53 +0100 X-Authenticated: #20450766 X-Provags-ID: V01U2FsdGVkX19XJxgftPJXF+0ySfF6gXUbAD+uO0JFM+hDh0iUa9 v5U9pxvqcv/AgM Received: from lyakh (helo=localhost) by axis700.grange with local-esmtp (Exim 4.63) (envelope-from ) id 1NiWcA-0002DI-Jj; Fri, 19 Feb 2010 18:26:06 +0100 Date: Fri, 19 Feb 2010 18:26:06 +0100 (CET) From: Guennadi Liakhovetski To: Baruch Siach cc: Linux Media Mailing List Subject: Re: [PATCH] v4l: soc_camera: fix bound checking of mbus_fmt[] index In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.47999999999999998 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]); Fri, 19 Feb 2010 17:25:59 +0000 (UTC) diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index f8d5c87..a4c0ef4 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c @@ -134,7 +134,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; }