From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien@xen.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Julien Grall" <jgrall@amazon.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: Re: [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()
Date: Mon, 30 Nov 2020 23:04:11 +0000 [thread overview]
Message-ID: <874kl678gl.fsf@epam.com> (raw)
In-Reply-To: <20201128113642.8265-1-julien@xen.org>
Hi Julien,
Julien Grall writes:
> 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_{,local_}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>
> Reviewed-by: Roger Paul Monné <roger.pau@citrix.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
For ARM part, obviously.
>
> ---
> Changes in v2:
> - Add Roger's reviewed-by for x86
> - Handle
> ---
> xen/arch/arm/irq.c | 12 ++++++++++--
> xen/arch/x86/irq.c | 7 ++++++-
> 2 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 3877657a5277..b71b099e6fa2 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -88,7 +88,11 @@ 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 = init_one_irq_desc(desc);
> +
> + if ( rc )
> + return rc;
> +
> desc->irq = irq;
> desc->action = NULL;
> }
> @@ -105,7 +109,11 @@ static int init_local_irq_data(void)
> for ( irq = 0; irq < NR_LOCAL_IRQS; irq++ )
> {
> struct irq_desc *desc = irq_to_desc(irq);
> - init_one_irq_desc(desc);
> + int 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;
--
Volodymyr Babchuk at EPAM
next prev parent reply other threads:[~2020-11-30 23:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 11:36 [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data() Julien Grall
2020-11-30 23:04 ` Volodymyr Babchuk [this message]
2020-12-02 17:03 ` Bertrand Marquis
2020-12-03 18:59 ` Stefano Stabellini
2021-01-13 19:05 ` [PING] " Julien Grall
2021-01-14 9:15 ` Jan Beulich
2021-01-14 9:18 ` Julien Grall
-- strict thread matches above, loose matches on Subject: below --
2020-11-28 11:31 Julien Grall
2020-11-28 11:37 ` 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=874kl678gl.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgrall@amazon.com \
--cc=julien@xen.org \
--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 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.