public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Chris Mason <clm@meta.com>,
	Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Cc: Chris Mason <clm@meta.com>, Xu Lu <luxu.kernel@bytedance.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] irqchip/aslint-sswi: request IO memory resource
Date: Sat, 17 Jan 2026 23:08:37 +0100	[thread overview]
Message-ID: <878qdv3na2.ffs@tglx> (raw)
In-Reply-To: <20260116124257.78357-1-clm@meta.com>

On Fri, Jan 16 2026 at 04:42, Chris Mason wrote:
> On Tue,  9 Dec 2025 16:23:33 +0200 Vladimir Kondratiev <vladimir.kondratiev@mobileye.com> wrote:
>
>> Make an aclint_sswi instance visible in the resource list,
>> i.e. /proc/iomem
>> 
>
> Hi everyone,
>
> I ran tip master through my AI review prompts, and this one was flagged.
> This is a lot of words for NULL vs ERR_PTR, but it looks right to me:
>
>> diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c
>> index fee30f3bc5ac2..325501f34a9bc 100644
>> --- a/drivers/irqchip/irq-aclint-sswi.c
>> +++ b/drivers/irqchip/irq-aclint-sswi.c
>> @@ -109,7 +109,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
>>  	if (!is_of_node(fwnode))
>>  		return -EINVAL;
>>
>> -	reg = of_iomap(to_of_node(fwnode), 0);
>> +	reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
>>  	if (!reg)
>>  		return -ENOMEM;
>
> Should this error check be updated? of_iomap() returns NULL on failure,
> but of_io_request_and_map() returns IOMEM_ERR_PTR() on failure which is
> non-NULL.
>
> When of_io_request_and_map() fails, the condition (!reg) will be false
> and the function continues with an invalid ERR_PTR value. This gets passed
> to aclint_sswi_parse_irq() which stores (reg + offset) into per_cpu
> sswi_cpu_regs, leading to a crash when IPIs are later sent.
>
> Other callers of of_io_request_and_map() in drivers/irqchip/ use IS_ERR()
> for the error check. For example, sun6i_r_intc_init() in irq-sun6i-r.c:
>
>     base = of_io_request_and_map(node, 0, NULL);
>     if (IS_ERR(base)) {
>         pr_err("%pOF: Failed to map MMIO region\n", node);
>         return PTR_ERR(base);
>     }

That's correct. Does anyone care to send a patch?

Thanks,

        tglx




  reply	other threads:[~2026-01-17 22:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 14:23 [PATCH] irqchip/aslint-sswi: request IO memory resource Vladimir Kondratiev
2025-12-15 21:47 ` [tip: irq/drivers] irqchip/aslint-sswi: Request " tip-bot2 for Vladimir Kondratiev
2026-01-16 12:42 ` [PATCH] irqchip/aslint-sswi: request " Chris Mason
2026-01-17 22:08   ` Thomas Gleixner [this message]
2026-01-18  8:28     ` [PATCH] irqchip/aslint-sswi: fix error checking Vladimir Kondratiev
2026-01-18 10:02       ` [tip: irq/drivers] irqchip/aslint-sswi: Fix error check of of_io_request_and_map() result tip-bot2 for Vladimir Kondratiev
2026-01-18 13:41       ` tip-bot2 for Vladimir Kondratiev

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=878qdv3na2.ffs@tglx \
    --to=tglx@kernel.org \
    --cc=clm@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luxu.kernel@bytedance.com \
    --cc=vladimir.kondratiev@mobileye.com \
    /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