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: <20251017112739.244021-1-tanze@kylinos.cn>
Date: Fri, 17 Oct 2025 19:27:39 +0800
From: tanze <tanze@...inos.cn>
To: colyli@...as.com,
	kent.overstreet@...ux.dev,
	john.g.garry@...cle.com
Cc: linux-kernel@...r.kernel.org,
	linux-bcache@...r.kernel.org,
	tanze <tanze@...inos.cn>
Subject: [PATCH v1] bcache: Use vmalloc_array() to improve code

Remove array_size() calls and replace vmalloc(), Due to vmalloc_array() is optimized better,
uses fewer instructions, and handles overflow more concisely[1].

Signed-off-by: tanze <tanze@...inos.cn>
---
Please ignore the previous email, a simple formatting error 
has been corrected in this one.

Thanks
---
 drivers/md/bcache/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index 826b14cae4e5..7bb5605ad7fb 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -1061,8 +1061,7 @@ 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));
 		if (!p)
 			return -ENOMEM;
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ