[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] 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: Thu, 19 Nov 2020 15:10:07 +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=4J8a5oaJM5LVFh5vHYCpAF5nJfxQRghTjNqBKLyX6TA=; b=SIB1Uq+ayKSyC8ZkjDZ2CbgRHJvk4cGazwPkjglXUZ0iVXWYqSwjLUZ3FGLZbyHsZsfkFSgnxp61/r7veUGdZ3f155CmSGNbgm5UXe9e8NX2BB9cynmjBA6iqfuqt6T7L2vLTb4ln5sxVHHk2ZlkmD77xJas+B1R06CeP368u65S/1lhRx2BY/TA28VQwgHzExyzSHdmIgpiUEJEWP72ERFBSxgDWytPaNrcfgBOc/27BFuEq7l+pF+14v0Lc2yYBOB7QVIaeSlop4xsdCIRpbyd5D2anoVM7WjauBBb9X3U7KzA20+pxfzSieb4jXbvgf0+ijlH84R4SZBOpMji9w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YzQM23IjjRCSK7eRz69vQMiFBIGN/8mO9aBb9XGl6a4rdk1bbkpovEzoXxiM4zAxQlcUmhbR7BuU0jR7qtoiGA5BLRC2IAuM1X2ehBUdZ7RIcqR26Kr0HoQNVFiYCFLwYNW4TJOaMuX4HilhmeR/vsLHu87jkGhrYTb8Pxvbp7r7LPwr5uJQEyGBs9ZwKD1UDivv/5LCjGSl5Ux7pnf2PDDM80CRLhIsAxVwHP7SLj6MNiuHbpJDGjJezM89GOmqYlEdXefT7QDn/bOIeYZJF4UyhezYhknq2oCTFnLLfVceyqSFieurINAj/mZmmEsP9+oQry78zKnCxrq2i11kdw==
- Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
- Cc: "open list:X86" <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: Thu, 19 Nov 2020 15:10:37 +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: AQHWvoP9L+A4RJEKVEq9qJlQ3XFKdanPjxgA
- Thread-topic: [PATCH] xen/irq: Propagate the error from init_one_desc_irq() in init_irq_data()
Hi,
> On 19 Nov 2020, at 14:54, 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_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: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Cheers
Bertrand
> ---
> 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
>
>
|