From patchwork Thu Mar 1 10:07:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10250689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C89AD6037D for ; Thu, 1 Mar 2018 10:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B57D3288A8 for ; Thu, 1 Mar 2018 10:08:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA13D288F1; Thu, 1 Mar 2018 10:08:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 214F9288A8 for ; Thu, 1 Mar 2018 10:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030210AbeCAKH5 (ORCPT ); Thu, 1 Mar 2018 05:07:57 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36268 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967178AbeCAKHc (ORCPT ); Thu, 1 Mar 2018 05:07:32 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w219v0FH043830; Thu, 1 Mar 2018 10:07:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=3i34TsvGwc/CGMJrpNW6AVZBXIw2rzcFroTWY5i1mgs=; b=L5MMhoU5dQyAjwp0KWxSJLzJaYWVaT5+5mv8ULiwV+Sx5fkdCPtGVWSS/onypvFvU+UZ +/8B7XXhVlfviXr7aggfgFhuCrB7MrtNRG5VljXr21ObABiD44XLOhxzS8vu8bzFoSCV 02+z0lWQcFc7mdMmNUUbrU5Nti/S5SK1oOMufaTVGLYgTd1Ha/cBAceax/5r7UgQVsJ8 y9DfZOhAY3FwToT3nh/ZXWGSkElJJ05YLCLUEyr6cgmI3kc/m9hFVbm/g6jT8Bo4AezY Ks806IGVCToGPr7ZDuD9kTeYRX4+kqbvq50DoGCIhhvknPVwh3JWaeyDAs8SfRIFIngx HQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2geevd87dy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Mar 2018 10:07:26 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w21A7PDj002787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Mar 2018 10:07:25 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w21A7OU5015382; Thu, 1 Mar 2018 10:07:24 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Mar 2018 02:07:24 -0800 Date: Thu, 1 Mar 2018 13:07:14 +0300 From: Dan Carpenter To: Shunqian Zheng Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] media: ov5695: Off by one in ov5695_enum_frame_sizes() Message-ID: <20180301100714.GA14140@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.3 (2018-01-21) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8818 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803010131 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ">" should be ">=" so that we don't read one element beyond the end of the array. Fixes: 8a77009be4be ("media: ov5695: add support for OV5695 sensor") Signed-off-by: Dan Carpenter diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index a4985a4715f5..9be38a0a2046 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -884,7 +884,7 @@ static int ov5695_enum_frame_sizes(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_frame_size_enum *fse) { - if (fse->index > ARRAY_SIZE(supported_modes)) + if (fse->index >= ARRAY_SIZE(supported_modes)) return -EINVAL; if (fse->code != MEDIA_BUS_FMT_SBGGR10_1X10)