From nobody Wed Dec 17 18:01:31 2025 Received: from ci74p00im-qukt09082501.me.com (ci74p00im-qukt09082501.me.com [17.57.156.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4103A1BEF8B for ; Mon, 9 Dec 2024 13:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.57.156.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733750780; cv=none; b=g7WyHjSsAKeg2p96NmE4uHE3enmQs3gACF3vsRd2nWz0Z8SEL+Wf9PJRPLrCqpKxj0F1MxTJcVntHodo1lHZZbq/xb/MkU6bJU1t/493CkN1y/dMVVK1irSuSzUqlAgBta2YeXNWBG5L/Cvz26FoBydYDR0whjwtIj3LLc3/hwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733750780; c=relaxed/simple; bh=DFw6nTypc9qtDehhi4TlSvMoG4svJBxuwnk7+yt/dgg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SUalVzcmi7l672Hxn9VO8AcJd36cASxIOdWCk4P60+SzsTXEWmd9notrWRghV858nHPUvUqJmk6sxLY1GewV5UQ2L5SZ+ghvkguaGqrZFFTXq8+qXLlmTU8SQ1Z+18A3lItRM8xtj2qdLmLOgWDPqU8Ly+VeZLBx6QeDuzMhDy8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=AvwBMk2Y; arc=none smtp.client-ip=17.57.156.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="AvwBMk2Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733750777; bh=43vrn8p072lQRlN2l1v4tjRk4GuMQ/6xBoBVPns9Qjo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=AvwBMk2YjY2K0SY0cydq9qNeDoqdQeOmUhtGa9ev5jxDty5wZ/H3JW0kuAhAk+j6h RV5LWqFTk0eF5SBSTka/HiIMa1FzunJzEMK2eOKkR2wVxMZGAHa7f755DSuJplVg0d ZTzqcwYsdVm085XqQu/1kiXrHG3dwagLx2xNbsXV6z0sSE8TZG9+JxpxNaVr5eNEy7 f8DxCJHTrx79JvCX+q1OexNid7VJvVOFungD0D2V63nJhjY6LhxPjpa6fJCln6HUrV 221iaBNFHqtuPhmu18ZTrqlOQ3kqiCehULsN06/BPPc684jp+tRsxR5H1/B3PXNLoC 2O0Lj+D5OmG3A== Received: from [192.168.1.26] (ci77p00im-dlb-asmtp-mailmevip.me.com [17.57.156.26]) by ci74p00im-qukt09082501.me.com (Postfix) with ESMTPSA id C41314AA0355; Mon, 9 Dec 2024 13:26:10 +0000 (UTC) From: Zijun Hu Date: Mon, 09 Dec 2024 21:25:02 +0800 Subject: [PATCH 4/8] of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241209-of_irq_fix-v1-4-782f1419c8a1@quicinc.com> References: <20241209-of_irq_fix-v1-0-782f1419c8a1@quicinc.com> In-Reply-To: <20241209-of_irq_fix-v1-0-782f1419c8a1@quicinc.com> To: Rob Herring , Saravana Kannan , Lorenzo Pieralisi , Bjorn Helgaas , Marc Zyngier , Stefan Wiehler , Grant Likely , Tony Lindgren , Kumar Gala , Thierry Reding , Julia Lawall , Jamie Iles , Grant Likely , Benjamin Herrenschmidt Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_irq_parse_one() may use uninitialized variable @addr_len as shown below: // @addr_len is uninitialized int addr_len; // This operation does not touch @addr_len if it fails. addr =3D of_get_property(device, "reg", &addr_len); // Use uninitialized @addr_len if the operation fails. if (addr_len > sizeof(addr_buf)) addr_len =3D sizeof(addr_buf); // Check the operation result here. if (addr) memcpy(addr_buf, addr, addr_len); Fix by initializing @addr_len before the operation. Fixes: b739dffa5d57 ("of/irq: Prevent device address out-of-bounds read in = interrupt map walk") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index cb39624a5e7799b9d2f4525f42dac4cd921ab403..64c005dfa23bd157d891f3f1052= 6327deb5e2cfa 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -361,6 +361,7 @@ int of_irq_parse_one(struct device_node *device, int in= dex, struct of_phandle_ar return of_irq_parse_oldworld(device, index, out_irq); =20 /* Get the reg property (if any) */ + addr_len =3D 0; addr =3D of_get_property(device, "reg", &addr_len); =20 /* Prevent out-of-bounds read in case of longer interrupt parent address = size */ --=20 2.34.1