From: Jarkko Sakkinen <jarkko@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: "Dan Carpenter" <error27@gmail.com>,
kernel-janitors@vger.kernel.org, linux-integrity@vger.kernel.org,
"Peter Hüwe" <peterhuewe@gmx.de>,
LKML <linux-kernel@vger.kernel.org>,
"Jason Gunthorpe" <jgg@ziepe.ca>
Subject: Re: [PATCH] tpm: clean up error checking in setup_ring()
Date: Sun, 11 Oct 2026 21:15:58 +0300 [thread overview]
Message-ID: <asvSXjQQ0vEvF7yL@kernel.org> (raw)
In-Reply-To: <74850205-dba2-4a97-951d-cda28be129c9@web.de>
On Sun, Oct 11, 2026 at 11:30:13AM +0200, Markus Elfring wrote:
> > The bind_evtchn_to_irqhandler() function can never return 0.
> …
>
> I suggest to reconsider information once more also according to the probability
> of return values from such a function.
> https://elixir.bootlin.com/linux/v7.3-rc6/source/drivers/xen/events/events_base.c#L1453-L1461
>
> bind_evtchn_to_irqhandler_chip()
> https://elixir.bootlin.com/linux/v7.3-rc6/source/drivers/xen/events/events_base.c#L1432-L1451
I'm not sure what you are trying to exactly or have hard time following
this response but if there is a problem it can be investigated. All I'm
seeing now is a collection of links and abstract statements.
I guess this is the function that picks the IRQ number:
static struct irq_info *xen_allocate_irq_dynamic(void)
{
int irq = irq_alloc_desc_from(0, -1);
struct irq_info *info = NULL;
if (irq >= 0) {
info = xen_irq_init(irq);
if (!info)
xen_irq_free_desc(irq);
}
return info;
}
And if I did not get loss while scavenging the call hierachy it ends
up to:
static int irq_find_free_area(unsigned int from, unsigned int cnt)
{
MA_STATE(mas, &sparse_irqs, 0, 0);
if (mas_empty_area(&mas, from, MAX_SPARSE_IRQS, cnt))
return -ENOSPC;
return mas.index;
}
And if I looked it up right @from == -1 and @cnt == 1 when
irq_find_free_area is reached.
I'm not IRQ code expert per se but in order to this never return zero,
sparse_irqs should not have it available?
I do agree that something in this patch does not appear right, or
at least not very well explained so it is a good catch anyhow.
My decision on this is that:
1. I'll drop the current patch as it actually does not make a case
why zero could not possibly happen. I spent 45 minutes browsing
because commit message did not have any technical details.
2. Even if it was legit it is hard to see that the change is high
priority for anyone.
3. However, I'm open for v2 with better tecnical backing if there
is any.
Br, Jarkko
prev parent reply other threads:[~2026-10-11 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 14:44 [PATCH] tpm: clean up error checking in setup_ring() Dan Carpenter
2026-10-02 23:31 ` Jarkko Sakkinen
2026-10-05 3:43 ` Jarkko Sakkinen
2026-10-11 9:30 ` Markus Elfring
2026-10-11 18:15 ` Jarkko Sakkinen [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=asvSXjQQ0vEvF7yL@kernel.org \
--to=jarkko@kernel.org \
--cc=Markus.Elfring@web.de \
--cc=error27@gmail.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.