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:   Sat, 27 Nov 2021 12:46:49 +0100
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     manoj@...ux.ibm.com, mrochs@...ux.ibm.com, ukrishn@...ux.ibm.com,
        jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH 2/2] scsi: cxlflash: Simplify usage of 'test_bit()'

'test_bit()' can access any bit of a bitmap. There is no need to precompute
anything. This just duplicate some computations and is more verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This is only partially compile tested because I don't have the needed
cross-compiling tool chain.
---
 drivers/scsi/cxlflash/vlun.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
index 5600082145bc..39de9ae49aaf 100644
--- a/drivers/scsi/cxlflash/vlun.c
+++ b/drivers/scsi/cxlflash/vlun.c
@@ -221,12 +221,7 @@ static u64 ba_alloc(struct ba_lun *ba_lun)
  */
 static int validate_alloc(struct ba_lun_info *bali, u64 aun)
 {
-	int idx = 0, bit_pos = 0;
-
-	idx = aun / BITS_PER_LONG;
-	bit_pos = aun % BITS_PER_LONG;
-
-	if (test_bit(bit_pos, (ulong *)&bali->lun_alloc_map[idx]))
+	if (test_bit(aun, (ulong *)bali->lun_alloc_map))
 		return -1;
 
 	return 0;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ