[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 2 Dec 2020 17:03:57 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5gQavw2fe5+oEYN5S7XHA8Tere3wHB4YJJKzmopc4uU=; b=F/Wb3rUPAKNEA/ANufcX3MsdjnB0XpnA3x8rKysdxMrxZcyRNlHVoeIQIqrnHC2CN3N09icbNxrnu+GATVA6snUmuyNcbeOI/L5xv72ABJq1CEj9Unoj9GBTLNeU7CGZlHgcVN0yHkHZVlkiT4nYrLHbaAz+7sn7TG7lHlpsIjEeO81Q6sT4vbDnce1UY4T+19hDjkp2V/uEgUYvQyMU7uX8Hr4RTKkTU2X3NSBpIFHlbIYFCE8wQfOIw9gd/llum3aNDziOYWyeAqUpRmcwf01AeAniFEk0096UlDuGDCUXzqf3Hpl+iJPabbHiUBVY7JGBEcc489Cb//wuEbNCzg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BLDy+jFlfZHyBdlhSVwxCvet8RL4xDy+233hXCZ1EQTwF6XG4C8NLcI3n1c3fWgpXONg32DwUOJc/oC+2o1GcFAGpSUiZMkYjIHBSdVG6eIpdz/jQpWu51t38LLVYEA3gVMz7e1buVms1/iARsqiuuTEUdznRlH4nw9FmImYU8cYXkv1dnXj4wmh3vt7NH3k52PlRcbgkOmoEDZijY1cWrqG0USRnr23pLRO0JTubrKDT1mbdpmbxr4wMKzlDxfyjJSMydWhDORV2KKnvCxfF9A20aGMNreyVeYDunp1DOxF67OTpqX5r9pE+r/D9CopiMLwZuyIM8yv1ZwD7J9NHw==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 02 Dec 2020 17:04:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWxXrf7kDHq9oT70mf9BS7rS/4g6nkD0iA
  • Thread-topic: [PATCH v2] xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()


> On 28 Nov 2020, at 11:36, Julien Grall <julien@xxxxxxx> wrote:
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> Reviewed-by: Roger Paul Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> 
> ---
>    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;
> -- 
> 2.17.1
> 
> 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.