From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29B51C3271F for ; Fri, 5 Jul 2024 10:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AU9ya2EmjL7f6PRwR8NRDfqoEmUnZunGxzD7XLPBGBs=; b=hxYJio8rj+dcjnSVxmLPeTE0tI 9E69gSULCu44WOmOWVm378rNGJyd01bYtVXSWn8vlmXPR5r+ajLWF1Oc2YnFpNkrlWLFIThm6Ih/V NRWGbgvlXShy8p7j+bZlvWo/YH4QsG3/81sTtKBZE+OMUskvXEb6DJmgeREvOPC0ZUydDUuPkuhq1 XR5thxzQ3VJEqGyG4D5EKwkGw7tzCtsndpajb7/3s/FIkouYfQ207Xa6H4qy9IlnJ2exMCQIhSiE3 lWHhftOy20AaUi+4Gf6vbOw8WEAIEUORoXZaygT4lapWrgGdZiUx/+rA3PDn73OSVA5fAwxpgLRGk ZEosxMKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPfzn-0000000FcDF-49g1; Fri, 05 Jul 2024 10:16:52 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPfzY-0000000Fc9G-1oho for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:16:38 +0000 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4658DGY1003029; Fri, 5 Jul 2024 12:16:27 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=selector1; bh=AU9ya2EmjL7f6PRwR8NRDfqo EmUnZunGxzD7XLPBGBs=; b=bnyhiSE+QYmF3tQt695vMdn0f6fkli3DP/ivuOW+ o24J4TNDbRkA27LLFyQovbrXoWXdgTtQ4a6n+N7AbQy1kFRMCKI3R+Rco0dyOnIe aypdVsO96BdW/Qsa7Va25jAwd8rQJuyGor/0/+FDJzz/WYibEuESvF5+3a6nHiT7 mE8u/s5Py7DZEVpWVMuJrUXP+qL7zvH8pENOJVf5HA+ZXCCA589mk3qxn5yq+Ifi Gh7B63/uw8f086sEyJFUVW2ojol6+a0wtJAkdLbHHZWAD9UzuNle+w/zml4Iaz0s kmGJCQsL2uzQOPpu8U5WrzFMccwcO10JvwrfQDmOHTMiww== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 405u9suwqa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jul 2024 12:16:27 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A47ED40049; Fri, 5 Jul 2024 12:16:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id AE37B220B41; Fri, 5 Jul 2024 12:15:49 +0200 (CEST) Received: from gnbcxd0016.gnb.st.com (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Jul 2024 12:15:49 +0200 Date: Fri, 5 Jul 2024 12:15:44 +0200 From: Alain Volmat To: Hans Verkuil CC: Linux Media Mailing List , Maxime Coquelin , Alexandre Torgue , Sakari Ailus , Hugues Fruchet , Linux Stable , "linux-stm32@st-md-mailman.stormreply.com" , , Linux Kernel Subject: Re: [PATCH] media: stm32: dcmipp: correct error handling in, dcmipp_create_subdevs Message-ID: <20240705101544.GA3926404@gnbcxd0016.gnb.st.com> Mail-Followup-To: Hans Verkuil , Linux Media Mailing List , Maxime Coquelin , Alexandre Torgue , Sakari Ailus , Hugues Fruchet , Linux Stable , "linux-stm32@st-md-mailman.stormreply.com" , linux-arm-kernel@lists.infradead.org, Linux Kernel References: <2dea6faf-53f6-461a-809b-ec572357ad07@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <2dea6faf-53f6-461a-809b-ec572357ad07@xs4all.nl> X-Disclaimer: ce message est personnel / this message is private X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_06,2024-07-03_01,2024-05-17_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_031637_210503_D8E6924D X-CRM114-Status: GOOD ( 23.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Hans, On Wed, Jul 03, 2024 at 01:59:16PM +0200, Hans Verkuil wrote: > From: Alain Volmat > > Correct error handling within the dcmipp_create_subdevs by properly > decrementing the i counter when releasing the subdevs. > > Fixes: 28e0f3772296 ("media: stm32-dcmipp: STM32 DCMIPP camera interface driver") > Cc: stable@vger.kernel.org > Signed-off-by: Alain Volmat > Signed-off-by: Hans Verkuil > [hverkuil: correct the indices: it's [i], not [i - 1].] > --- > The original patch would cause a crash due to the incorrect indices in the > statement after the while. Since 'i' can now become 0, so i - 1 would be a > negative index access, which was obviously not the intention. > > I reverted the patch once I noticed this (better to hang in an infinite > loop than to crash), but I want to get a proper fix in. Rather than > waiting for that, I decided to just take the original patch from Alain, with > just the indices fixed. sorry for the delay and this error within the patch. Thanks a lot Hans and Sakari for noticing it and fixing it. Alain > --- > drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c > index 4acc3b90d03a..7f771ea49b78 100644 > --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c > +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c > @@ -202,8 +202,8 @@ static int dcmipp_create_subdevs(struct dcmipp_device *dcmipp) > return 0; > > err_init_entity: > - while (i > 0) > - dcmipp->pipe_cfg->ents[i - 1].release(dcmipp->entity[i - 1]); > + while (i-- > 0) > + dcmipp->pipe_cfg->ents[i].release(dcmipp->entity[i]); > return ret; > } > > -- > 2.43.0 >