Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4290019rdh; Tue, 28 Nov 2023 18:12:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtU2WMAHX0KUa7uEHseTYUAJCL43KHA+0NWnxMTFglc2Dfind0A5/Q1GxdwOEcOm2kfc65 X-Received: by 2002:a9d:5c0f:0:b0:6d6:441a:a6c with SMTP id o15-20020a9d5c0f000000b006d6441a0a6cmr17674234otk.12.1701223974415; Tue, 28 Nov 2023 18:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701223974; cv=none; d=google.com; s=arc-20160816; b=hKZy/jhET4uEVQFolTg0WPCc7EKDnKu800R6aCTmPjoSzjk1gfkeD3tIg6RwbKgven Lz7nWlcvk3HBSuyGenHhIPq+Gp3MRtcMoTpufvD5EnrxTDjX5xdqV0fex66amI2Z8dTq dskP+G65CjWarCzkNc6WcmvEw+HrfPp0PC9N+tJUP8Q/ktVbVUFDZPWUkD0VvRXTE3Lb 51cifkZOfU0g8zbitL9g/jDmBBEO3CmI++uEfK+B/F9YQr8r5sqfUgAK3+ARxXHBAd3d Rij15io72mSqkMRsjbvJLVXPm2C/PqfPK+Un9Wv9UyNKnK8SExZaCM12oG8C/yEZ7yrN eiVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=hkp6GXXOXQ9dZ5UWMPLvm6VuEPjzOhU3vujnb4rBUMo=; fh=2SakoZ+TLN/SxQ59987KIezPxxC1PisG+s7bI5TLvMw=; b=pP43gCTLFlEWhC58Rksu4Di0+s20qkiblIJR+81pEjAy/+wWFyIAzDymU1FuLrm6/n RNb/MIqh34HO+0KXW5DGsC8upt7v+HcOaF5UqrDjMhzDOn2LG+MuP3ngb5zrLFjgNl9U qvR/dxwzwJyjxaPIgpNChku57TD7dbtnj110n3Jy/0UfB8hwuu4SE3eXWkfMuUMArtag bqalvCbqHyeJpXewCDRYmRZ3IIj4XdLt4WqWhwFLSIbLGAHs9p/v5YZueJzX2o1t0TK9 ckK33alWRkK6qNuq5j71oKjklsLtEkPSGTLkuRYXXRJZNFWGZL97YVZ/Wm2+Mcm0sZfZ 4Wfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id e20-20020a63e014000000b005b9a1494637si13047807pgh.317.2023.11.28.18.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 18:12:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A9F6F80ADECA; Tue, 28 Nov 2023 18:12:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjK2CLC (ORCPT + 99 others); Tue, 28 Nov 2023 21:11:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjK2CLB (ORCPT ); Tue, 28 Nov 2023 21:11:01 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF557198D; Tue, 28 Nov 2023 18:11:03 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 8EF8924E29A; Wed, 29 Nov 2023 10:10:55 +0800 (CST) Received: from EXMBX162.cuchost.com (172.16.6.72) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 29 Nov 2023 10:10:54 +0800 Received: from [192.168.125.107] (113.72.145.176) by EXMBX162.cuchost.com (172.16.6.72) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 29 Nov 2023 10:10:53 +0800 Message-ID: Date: Wed, 29 Nov 2023 10:10:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: staging: starfive: camss: fix off by one in isp_enum_mbus_code() To: Dan Carpenter , Jack Zhu CC: Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil , , , , References: <7d222638-2d19-466d-8dd4-9e1ceb1d46f3@moroto.mountain> Content-Language: en-US From: Changhuang Liang In-Reply-To: <7d222638-2d19-466d-8dd4-9e1ceb1d46f3@moroto.mountain> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [113.72.145.176] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX162.cuchost.com (172.16.6.72) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 18:12:49 -0800 (PST) On 2023/11/28 22:40, Dan Carpenter wrote: > These > comparisons should be >=. The formats->fmts[] array is either > a pointer to isp_formats_sink[] or isp_formats_source[] respectively. > > Fixes: e57854628f58 ("media: staging: media: starfive: camss: Add ISP driver") > Signed-off-by: Dan Carpenter Reviewed-by: Changhuang Liang > --- > drivers/staging/media/starfive/camss/stf-isp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c > index 893dbd8cddc8..98d61d71c31b 100644 > --- a/drivers/staging/media/starfive/camss/stf-isp.c > +++ b/drivers/staging/media/starfive/camss/stf-isp.c > @@ -120,7 +120,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd, > const struct stf_isp_format_table *formats; > > if (code->pad == STF_ISP_PAD_SINK) { > - if (code->index > ARRAY_SIZE(isp_formats_sink)) > + if (code->index >= ARRAY_SIZE(isp_formats_sink)) > return -EINVAL; > > formats = &isp_dev->formats[SINK_FORMATS_INDEX]; > @@ -128,7 +128,7 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd, > } else { > struct v4l2_mbus_framefmt *sink_fmt; > > - if (code->index > ARRAY_SIZE(isp_formats_source)) > + if (code->index >= ARRAY_SIZE(isp_formats_source)) > return -EINVAL; > > sink_fmt = v4l2_subdev_state_get_format(state,