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: <pnqowugugnnhnaibg5jikdwowv5ycwtcwarddopfylwk6wbvik@t5kwuwukt2ga>
Date: Thu, 23 Oct 2025 13:00:26 +0800
From: "Coly Li" <colyli@...as.com>
To: "tanze" <tanze@...inos.cn>
Cc: <john.g.garry@...cle.com>, <kent.overstreet@...ux.dev>, 
	<linux-bcache@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] bcache: Use vmalloc_array() to improve code

On Thu, Oct 23, 2025 at 10:26:42AM +0800, tanze wrote:
> Remove array_size() calls and replace vmalloc(),
> due to vmalloc_array() being optimized better,
> using fewer instructions, and handling overflow more concisely.
> 
> Signed-off-by: tanze <tanze@...inos.cn>
> ---
> Hi, Coly Li.
> 
> Thank you for your suggestions. 
> I have made revisions according to your requirements. 
> Do you have any further suggestions?
> 
> ---
> Changes in v2:
> - Fix coding style and formatting issues.
> ---
>  drivers/md/bcache/sysfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 826b14cae4e5..1ecd2cb3d302 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -1061,8 +1061,8 @@ SHOW(__bch_cache)
>  		uint16_t q[31], *p, *cached;
>  		ssize_t ret;
>  
> -		cached = p = vmalloc(array_size(sizeof(uint16_t),
> -						ca->sb.nbuckets));
> +		cached = p = vmalloc_array(ca->sb.nbuckets, sizeof(uint16_t));
> +
^^^^-> this empty line is new in v2 patch, and I would suggest to remove it.


>  		if (!p)
>  			return -ENOMEM;

Rested part looks fine.

Thanks.

Coly Li

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ