lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4d89c9da-be5e-34ac-3334-3f1c01576182@embeddedor.com>
Date:   Tue, 28 May 2019 18:00:02 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Joe Perches <joe@...ches.com>, mingo@...nel.org,
        marc.zyngier@....com, linux-kernel@...r.kernel.org, hpa@...or.com,
        tglx@...utronix.de, geert+renesas@...der.be,
        linux-tip-commits@...r.kernel.org
Subject: Re: [tip:irq/core] genirq/irqdomain: Remove WARN_ON() on
 out-of-memory condition



On 5/28/19 5:54 PM, Joe Perches wrote:
> On Tue, 2019-05-28 at 13:23 -0700, tip-bot for Geert Uytterhoeven wrote:
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> []
>> @@ -139,7 +139,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
>>  
>>  	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
>>  			      GFP_KERNEL, of_node_to_nid(of_node));
>> -	if (WARN_ON(!domain))
>> +	if (!domain)
>>  		return NULL;
>>  
>>  	if (fwnode && is_fwnode_irqchip(fwnode)) {
> 
> This could also use the struct_size macro if desired.
> 

ACK this.

> Oddly, this seems to reduce object size (gcc 8.3.0)
> but it's probably unrelated.
> 
> ---
>  kernel/irq/irqdomain.c | 2 +-.
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index e7d17cc3a3d7..93a984a82154 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -137,7 +137,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
>  
>  	static atomic_t unknown_domains;
>  
> -	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
> +	domain = kzalloc_node(struct_size(domain, linear_revmap, size),
>  			      GFP_KERNEL, of_node_to_nid(of_node));
>  	if (!domain)
>  		return NULL;
> 
> 

--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ