xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: xen-devel@lists.xenproject.org
Cc: "Julien Grall" <jgrall@amazon.com>,
	"Roger Paul Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()
Date: Sat, 28 Nov 2020 11:37:15 +0000	[thread overview]
Message-ID: <1682e9e6-a1b2-f0e9-2cba-f7154c5e02b7@xen.org> (raw)
In-Reply-To: <20201128113102.6446-1-julien@xen.org>

Hi,

Please ignore this version as I forgot to call add_maintainers.pl.

Sorry for the noise.

Cheers,

On 28/11/2020 11:31, Julien Grall wrote:
> 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>
> 
> ---
>      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;
> 

-- 
Julien Grall


  reply	other threads:[~2020-11-28 11:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 11:31 [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data() Julien Grall
2020-11-28 11:37 ` Julien Grall [this message]
2020-11-28 11:36 Julien Grall
2020-11-30 23:04 ` Volodymyr Babchuk
2020-12-02 17:03 ` Bertrand Marquis
2020-12-03 18:59   ` Stefano Stabellini

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=1682e9e6-a1b2-f0e9-2cba-f7154c5e02b7@xen.org \
    --to=julien@xen.org \
    --cc=jgrall@amazon.com \
    --cc=roger.pau@citrix.com \
    --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).