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>] [day] [month] [year] [list]
Message-ID: <704d0aade3c8ed4ff64f6ddf81edfb409514be92.1722112623.git.christophe.jaillet@wanadoo.fr>
Date: Sat, 27 Jul 2024 22:37:27 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: James Smart <james.smart@...adcom.com>,
	Dick Kennedy <dick.kennedy@...adcom.com>,
	"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	linux-scsi@...r.kernel.org
Subject: [PATCH] scsi: lpfc: Use bitmap_size()

Use bitmap_size() instead of hand-writing it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 drivers/scsi/lpfc/lpfc_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 2697da3248b3..8dfceb0938b0 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -21,6 +21,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
+#include <linux/bitmap.h>
 #include <linux/mempool.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
@@ -78,8 +79,7 @@ lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) {
 
 	if (max_xri <= 0)
 		return -ENOMEM;
-	bytes = ((BITS_PER_LONG - 1 + max_xri) / BITS_PER_LONG) *
-		  sizeof(unsigned long);
+	bytes = bitmap_size(max_xri);
 	phba->cfg_rrq_xri_bitmap_sz = bytes;
 	phba->active_rrq_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE,
 							    bytes);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ