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]
Date: Wed, 10 Apr 2024 07:48:02 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Dawei Li <set_pte_at@...look.com>
Cc: wim@...ux-watchdog.org, linux-watchdog@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog/wdt-main: Use cpumask_of() to avoid cpumask var
 on stack

On Wed, Apr 10, 2024 at 09:13:59PM +0800, Dawei Li wrote:
> In general it's preferable to avoid placing cpumasks on the stack, as
> for large values of NR_CPUS these can consume significant amounts of
> stack space and make stack overflows more likely.
> 
> Use cpumask_of() to avoid the need for a temporary cpumask on the stack
> 
> Signed-off-by: Dawei Li <set_pte_at@...look.com>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
>  drivers/watchdog/octeon-wdt-main.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c
> index 0fe71f7e66d5..52d49e4e35a0 100644
> --- a/drivers/watchdog/octeon-wdt-main.c
> +++ b/drivers/watchdog/octeon-wdt-main.c
> @@ -381,11 +381,7 @@ static int octeon_wdt_cpu_online(unsigned int cpu)
>  
>  	/* Must set the irq affinity here */
>  	if (octeon_has_feature(OCTEON_FEATURE_CIU3)) {
> -		cpumask_t mask;
> -
> -		cpumask_clear(&mask);
> -		cpumask_set_cpu(cpu, &mask);
> -		irq_set_affinity(irq, &mask);
> +		irq_set_affinity(irq, cpumask_of(cpu));
>  	}
>  
>  	cpumask_set_cpu(cpu, &irq_enabled_cpus);
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ