From: Radu Rendec <radu@rendec.net>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>, Thomas Gleixner <tglx@kernel.org>
Cc: Paul Walmsley <pjw@kernel.org>,
Samuel Holland <samuel.holland@sifive.com>,
Charles Mirabile <cmirabil@redhat.com>,
Lucas Zampieri <lzampier@redhat.com>,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask
Date: Sat, 29 Aug 2026 16:10:14 -0400 [thread overview]
Message-ID: <1778ce7c2880eb5eb719932b5273776a57eea481.camel@rendec.net> (raw)
In-Reply-To: <20260825151000.1-plic-bit31-caplitmus-rv@iscas.ac.cn>
On Tue, 2026-08-25 at 15:33 +0800, Pengpeng Hou wrote:
> __plic_toggle() builds a 32-bit enable-register mask from the hardware
> interrupt number. A valid interrupt whose low five bits are 31 evaluates
> 1 << 31, which shifts a signed int into its sign bit and is undefined
> behavior.
>
> Use BIT(), matching the equivalent mask construction in plic_irq_eoi().
>
> Fixes: 14ff9e54dd14 ("irqchip/sifive-plic: Cache the interrupt enable state")
Thanks for the patch! The patch itself looks good but the Fixes tag
above does not correctly identify the commit that introduced the
problematic line. Ironically, that's one of the few lines in that
function that were *not* modified in that commit.
Please use "git blame" to find the right commit, and resend the patch
with a correct Fixes tag.
> Assisted-by: Codex:gpt-5
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> 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 5b0dac104814..d3d4187b96ab 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -108,6 +108,6 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type);
> static void __plic_toggle(struct plic_handler *handler, int hwirq, int enable)
> {
> u32 __iomem *base = handler->enable_base;
> - u32 hwirq_mask = 1 << (hwirq % 32);
> + u32 hwirq_mask = BIT(hwirq % 32);
> int group = hwirq / 32;
> u32 value;
--
Regards,
Radu
prev parent reply other threads:[~2026-08-29 20:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 7:33 Pengpeng Hou
2026-08-29 20:10 ` Radu Rendec [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1778ce7c2880eb5eb719932b5273776a57eea481.camel@rendec.net \
--to=radu@rendec.net \
--cc=cmirabil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lzampier@redhat.com \
--cc=pengpeng@iscas.ac.cn \
--cc=pjw@kernel.org \
--cc=samuel.holland@sifive.com \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®