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: <0b7b6ca3-b05b-40f2-86cf-083beb72727c@gmail.com>
Date: Wed, 25 Sep 2024 11:55:51 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 linux-kernel@...r.kernel.org
Cc: Mark Brown <broonie@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1 1/1] regmap-irq: Consistently use memset32() in
 regmap_irq_thread()

On 9/25/24 11:27, Andy Shevchenko wrote:
> The commit 4d60cac951fd ("regmap-irq: Add no_status support") adds
> an additional branch into IRQ thread handler in regmap. It wisely
> chose to use memset32() as it might be optimised on some architectures
> and hence give a performance benefit. At the same time the old code
> continue using simple memset(). Update the old code to use memset32().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>   drivers/base/regmap/regmap-irq.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
> index a750e48a26b8..33ec28e3a802 100644
> --- a/drivers/base/regmap/regmap-irq.c
> +++ b/drivers/base/regmap/regmap-irq.c
> @@ -364,14 +364,11 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
>   		memset32(data->status_buf, GENMASK(31, 0), chip->num_regs);
>   	} else if (chip->num_main_regs) {
>   		unsigned int max_main_bits;
> -		unsigned long size;
> -
> -		size = chip->num_regs * sizeof(unsigned int);
>   
>   		max_main_bits = (chip->num_main_status_bits) ?
>   				 chip->num_main_status_bits : chip->num_regs;
>   		/* Clear the status buf as we don't read all status regs */
> -		memset(data->status_buf, 0, size);
> +		memset32(data->status_buf, 0, chip->num_regs);
>   
>   		/* We could support bulk read for main status registers
>   		 * but I don't expect to see devices with really many main

Thanks Andy.

Can we guarantee the sizeof(unsigned int) == sizeof(uint32_t) on all 
supported architectures? (The status_buf is unsigned int, right?). If 
yes, then this looks nice to me.

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ