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 AE47CC4345F for ; Fri, 12 Apr 2024 08:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AVgbRtAcxcblX1YlWN9xNv829fccUm+ZUZgGvgSPUgI=; b=MySLWtafWFTP2d B8ViPajra+QZYJXoXOuyYhS4fGuEAuxy4SMKgfKHt1LfzrohfU/ECqQrjDdL8o0sKpdZADPQj/1Mq 8KZBZLCQCLZXS/4P5qhzejuvR1hvZHgV8tIgnOxDC9E9EXp0ZgCHIgdAm0wRzQIEVjEpm1OOM70SO fVbCRGJW/1+y0JihMqclMU6yX5+cLTbPfk413vJNJfWzQMiiMvB2CtJd+WGS6JftYEYkw1HPt9eSI KQsdHNAJCeoU7uGmT1zLqYH6wcaoofCzTOtwAabJq4QHFy2KrEKpiEKM2UgjlNFi2Xx5DoCDZk4Tv +PwyRvth1f0EvWtqHjNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvCfY-0000000GEV1-24Fg; Fri, 12 Apr 2024 08:54:00 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvCfU-0000000GENh-3jkv for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 08:53:58 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43C8RL2t009700; Fri, 12 Apr 2024 10:53:34 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=WjFgtosidiIyq2Zmcjtu8dtER2lY9hSTMSWSMhZ3Xas=; b=3q 2TCxFt8NbxX6zobRUXOLJRewuDgTt1BN3myoUYyhH9sDhS0f5EqUIsnxCc4vyRK1 e5RnWZgq0T6Qxn4IHCk9Q+MqpzuHzkcy35F+6OhcfwpcL9GBACuzt3fXeVlruiya tuNV3dtKagQfB4J5uFWJmBEMxZmVMHmK3SFRcwpNoZmEsMVsboWDPnwQLIR5eCNZ LQJzJ6n0C9qg+jqZPOV6icC49jOXQbtm0Irqq8+tUGQ7Kn01yuReBSGF7KmJOuZY vSdcaNjGoHN4VcAZ1atP4hoJMmPn8NKIk2totehDNSByEPo4zuhwCgl/Vquf2eUx gUvLjF+/e0bMCUhSRSTQ== 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 3xaw9d86vt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2024 10:53:34 +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 70A6D40044; Fri, 12 Apr 2024 10:53:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 80195210729; Fri, 12 Apr 2024 10:53:07 +0200 (CEST) Received: from [10.48.86.69] (10.48.86.69) 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.27; Fri, 12 Apr 2024 10:53:07 +0200 Message-ID: Date: Fri, 12 Apr 2024 10:52:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] bus: stm32_firewall: fix off by one in stm32_firewall_get_firewall() To: Dan Carpenter CC: Maxime Coquelin , Alexandre Torgue , , , , References: <17dce071-21ef-49f5-be45-f93bbf3642ec@moroto.mountain> Content-Language: en-US From: Gatien CHEVALLIER In-Reply-To: <17dce071-21ef-49f5-be45-f93bbf3642ec@moroto.mountain> X-Originating-IP: [10.48.86.69] 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.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-12_05,2024-04-09_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_015357_418751_757E44CF X-CRM114-Status: GOOD ( 13.18 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Dan, On 4/12/24 10:25, Dan Carpenter wrote: > The "nb_firewall" variable is the number of elements in the firewall[] > array, which is allocated in stm32_firewall_populate_bus(). So change > this > comparison to >= to prevent an out of bound access. > > Fixes: 5c9668cfc6d7 ("firewall: introduce stm32_firewall framework") > Signed-off-by: Dan Carpenter > --- > drivers/bus/stm32_firewall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/bus/stm32_firewall.c b/drivers/bus/stm32_firewall.c > index decb79449047..2fc9761dadec 100644 > --- a/drivers/bus/stm32_firewall.c > +++ b/drivers/bus/stm32_firewall.c > @@ -53,7 +53,7 @@ int stm32_firewall_get_firewall(struct device_node *np, struct stm32_firewall *f > return err; > } > > - if (j > nb_firewall) { > + if (j >= nb_firewall) { > pr_err("Too many firewall controllers"); > of_node_put(provider); > return -EINVAL; Thank you. Reviewed-by: Gatien Chevallier _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel