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] [thread-next>] [day] [month] [year] [list]
Message-ID: <b315cbe2e1264d98b57ce57fe5f66a23@AcuMS.aculab.com>
Date: Sun, 6 Oct 2024 17:13:16 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Bart Van Assche' <bvanassche@....org>, Thomas Gleixner
	<tglx@...utronix.de>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Russell King
	<linux@...linux.org.uk>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Clemens Ladisch <clemens@...isch.de>
Subject: RE: [PATCH 07/21] hpet: Switch to number_of_interrupts()

From: Bart Van Assche
> Sent: 30 September 2024 19:16
> 
> Use the number_of_interrupts() function instead of the global variable
> 'nr_irqs'. This patch prepares for changing 'nr_irqs' from an exported
> global variable into a variable with file scope.
> 
> Cc: Clemens Ladisch <clemens@...isch.de>
> Signed-off-by: Bart Van Assche <bvanassche@....org>
> ---
>  drivers/char/hpet.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
> index e904e476e49a..e618ae66587d 100644
> --- a/drivers/char/hpet.c
> +++ b/drivers/char/hpet.c
> @@ -195,7 +195,7 @@ static void hpet_timer_set_irq(struct hpet_dev *devp)
>  		v &= ~0xffff;
> 
>  	for_each_set_bit(irq, &v, HPET_MAX_IRQ) {
> -		if (irq >= nr_irqs) {
> +		if (irq >= number_of_interrupts()) {
>  			irq = HPET_MAX_IRQ;
>  			break;
>  		}

This is horrid.
You've replaced the read of a global variable (which, in some cases the
compiler might be able to pull outside the loop) with a real function
call in every loop iteration.

With all the mitigations for cpu speculative execution 'issues' you
pretty much don't want trivial function calls.

If you are worried about locals shadowing globals just change one of the names.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ