From: Julien Grall <julien@xen.org>
To: xen-devel@lists.xenproject.org
Cc: julien@xen.org, "Julien Grall" <jgrall@amazon.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH] xen/irq: Propagate the error from init_one_desc_irq() in init_irq_data()
Date: Thu, 19 Nov 2020 14:54:34 +0000 [thread overview]
Message-ID: <20201119145434.28065-1-julien@xen.org> (raw)
From: Julien Grall <jgrall@amazon.com>
init_one_desc_irq() can return an error if it is unable to allocate
memory. While this is unlikely to happen during boot (called from
init_irq_data()), it is better to harden the code by propagting the
return value.
Spotted by coverity.
CID: 106529
Signed-off-by: Julien Grall <jgrall@amazon.com>
---
xen/arch/arm/irq.c | 7 ++++++-
xen/arch/x86/irq.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 3877657a5277..279d221a2b85 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -88,7 +88,12 @@ static int __init init_irq_data(void)
for ( irq = NR_LOCAL_IRQS; irq < NR_IRQS; irq++ )
{
struct irq_desc *desc = irq_to_desc(irq);
- init_one_irq_desc(desc);
+ int rc;
+
+ rc = init_one_irq_desc(desc);
+ if ( rc )
+ return rc;
+
desc->irq = irq;
desc->action = NULL;
}
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 45966947919e..3ebd684415ac 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -428,9 +428,14 @@ int __init init_irq_data(void)
for ( irq = 0; irq < nr_irqs_gsi; irq++ )
{
+ int rc;
+
desc = irq_to_desc(irq);
desc->irq = irq;
- init_one_irq_desc(desc);
+
+ rc = init_one_irq_desc(desc);
+ if ( rc )
+ return rc;
}
for ( ; irq < nr_irqs; irq++ )
irq_to_desc(irq)->irq = irq;
--
2.17.1
next reply other threads:[~2020-11-19 14:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 14:54 Julien Grall [this message]
2020-11-19 15:10 ` [PATCH] xen/irq: Propagate the error from init_one_desc_irq() in init_irq_data() Bertrand Marquis
2020-11-19 15:11 ` Roger Pau Monné
2020-11-28 11:27 ` Julien Grall
2020-11-19 23:44 ` Stefano Stabellini
2020-11-28 11:25 ` Julien Grall
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=20201119145434.28065-1-julien@xen.org \
--to=julien@xen.org \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgrall@amazon.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).