From nobody Mon Feb 9 15:12:28 2026 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [195.130.132.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D81DE18B48D for ; Tue, 20 Aug 2024 12:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724156225; cv=none; b=WlJvyt0HSvNC+Bkvn2pF2LE6u0cV9HKbT6KvvDkh2JgB7vI4DIpx616UY+O00t3ZCoJYCFbBjx7vQjLPGUHreRwAy2oNemryliaZZnGVvYlU1hFckE3HgOR4+8Qh3tqy1P7EYsR0WvNMW2H6EaDzfUML9Y4L7DnVfE+rqDkOjA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724156225; c=relaxed/simple; bh=RS+EHn26H9QizywcTT08//7IEUQd34ChaZrvzRgEcr4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RgHmKHs7T+J/U06hUHKc2GhDiliup2N2IPG6+7UHBevecZOepOwjd/rEUAbisLDJGDCuZBfIz/QYxCSzPdVa0xoQ7hClVPm0MdtzVZ7KKZmIa1QQnpd/Hf/X3G92KzgAwPVm4XBM/+RGOSkZmDoNFzU0Js4lhLKyOK8bJZlS8CE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:a2e4:464c:5828:2da3]) by baptiste.telenet-ops.be with bizsmtp id 2CGv2D00P2WQTnu01CGvLN; Tue, 20 Aug 2024 14:16:55 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sgNnC-000NrD-Hf; Tue, 20 Aug 2024 14:16:55 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sgNnC-001nqn-WF; Tue, 20 Aug 2024 14:16:55 +0200 From: Geert Uytterhoeven To: Stefan Wiehler , Rob Herring , Saravana Kannan Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] of/irq: Refer to actual buffer size in of_irq_parse_one() Date: Tue, 20 Aug 2024 14:16:53 +0200 Message-Id: <817c0b9626fd30790fc488c472a3398324cfcc0c.1724156125.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace two open-coded calculations of the buffer size by invocations of sizeof() on the buffer itself, to make sure the code will always use the actual buffer size. Signed-off-by: Geert Uytterhoeven --- If you think this warrants a Fixes-tag: Fixes: b739dffa5d570b41 ("of/irq: Prevent device address out-of-bounds = read in interrupt map walk") --- drivers/of/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index cc30b471e446045a..36351ad6115eb10e 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -357,8 +357,8 @@ int of_irq_parse_one(struct device_node *device, int in= dex, struct of_phandle_ar addr =3D of_get_property(device, "reg", &addr_len); =20 /* Prevent out-of-bounds read in case of longer interrupt parent address = size */ - if (addr_len > (3 * sizeof(__be32))) - addr_len =3D 3 * sizeof(__be32); + if (addr_len > sizeof(addr_buf)) + addr_len =3D sizeof(addr_buf); if (addr) memcpy(addr_buf, addr, addr_len); =20 --=20 2.34.1