From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379579; b=S3FUdFCeZLIGk8rcWym1dBrw+gneUbd408XF1TL/3UvhXfxa3YepZiGK65LeI7b7jUBg vBFE5X8WcxbcgPmFyRoWZPzIzB6kV7tLb+g0dBBfma795f0F3fR4hr8KngMhIccmA6Zja i98xaPGUWzHOpI6GQkOHXdZ9wsPpC11dR/bzDspTJ6WDF0n/EnVd4JVe9IAqC/UBbSKfw jM/y6DLe0pUFdheotXQ9AMSQpIqQ7ZE9E9YX4JZcJ65/3C3aNZFgDNdAUOVi8m8NV+l+a fi3XkHP/QeWTSF1AuxqYcB+tHYQpLEuz6JIypzaQBeyavPhWjF4pA7X9GleCDf9kCaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379579; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Syhxsa0nKVA2JivbxW+ffPVmDOTszu25pi2KuQ+czGo=; b=xD7Kl1pR/mUKGt2pZIHgP+VfpTjFV6k5wzkzMm/VM18IzVqmZmoZPsPVflcOixEl5RH8 uoCpnR6E8vYGCucQuncwNe43HzOjfoNMJz8FkDVh8rik9D00XmgEwTM3D+cr23UD6TQ2C MT3XpxHjEXik1hzHm+9D8Lk7SNuoeKsutQX6L6ug0J+p7gfvdtkQ8OoKbj7ChVs//A4b8 lkBjTj7c+CBfhV9QPJyI3McRH5966DtcpduTqBTjDJkQO1FUzMZKuO37fDwqDaDkXOfkn i3CxyPrp4uEIrmGQLd/OfaM/IIqILreECgt7SWFjlpcRo6j6re9rbnCQUHfQldH2v4w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mlCuP8d6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69C6D606A322; Fri, 4 Dec 2026 10:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mlCuP8d6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D52AD1F000CE; Fri, 4 Dec 2026 10:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379579; bh=Syhxsa0nKVA2JivbxW+ffPVmDOTszu25pi2KuQ+czGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mlCuP8d62vqFS7gEPzvw+KQ2n0nmYFqJN2o1zS+SxDWZGlFC6RWHOjgR+OZqMhlVa hF+o5EkuuqZL5tKPreLiYOsXzzkyffULd4DLr6Vs8C99m/qxlcKGCfn80hE1nkdNvc oGmIZNBkq0Ae+ON2u/7Lw9nePU19441a6QNtP4KQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pengpeng Hou , Thomas Gleixner , Sasha Levin Subject: [PATCH 6.1 0008/1059] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Date: Fri, 4 Dec 2026 18:52:19 +0900 Message-ID: <20261204100644.223044801@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pengpeng Hou [ Upstream commit 0f214e5bbee59d5952d3c061fd65ed9a1e175981 ] __plic_toggle() builds a 32-bit interrupt enable mask using a signed integer literal. A valid interrupt selecting bit 31 evaluates 1 << 31, which shifts a signed int into its sign bit. Use BIT(), matching the equivalent mask construction in plic_irq_eoi(). The resulting mask remains representable in u32 on both RV32 and RV64. The issue was found by our static-analysis tool. Fixes: 8237f8bc4f6e ("irqchip: add a SiFive PLIC driver") Signed-off-by: Pengpeng Hou Signed-off-by: Thomas Gleixner Assisted-by: gpt 5 Link: https://patch.msgid.link/caplitmus-rv.v2.plic.87a8fc444de44e109889ba28703c76f3@163.com [ sashal: Context lines adapted to the older __plic_toggle() signature and direct register write, applying only the 1 << (hwirq % 32) to BIT(hwirq % 32) change. ] Signed-off-by: Sasha Levin --- drivers/irqchip/irq-sifive-plic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index fb1dae22ab17f..396fb37abf611 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -89,7 +89,7 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type); static void __plic_toggle(void __iomem *enable_base, int hwirq, int enable) { u32 __iomem *reg = enable_base + (hwirq / 32) * sizeof(u32); - u32 hwirq_mask = 1 << (hwirq % 32); + u32 hwirq_mask = BIT(hwirq % 32); if (enable) writel(readl(reg) | hwirq_mask, reg); -- 2.53.0