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]
Date:   Wed, 07 Oct 2020 12:42:05 +0800
From:   ching Huang <ching2048@...ca.com.tw>
To:     martin.petersen@...cle.com, James.Bottomley@...senPartnership.com,
        linux-scsi@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 2/2] scsi: arcmsr: use round_up() instead of logical
 operation

From: ching Huang <ching2048@...ca.com.tw>

Use round_up() instead of logical operation.

Reported-by: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: ching Huang <ching2048@...ca.com.tw>
---

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 55d85c9..1e358d9 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -644,13 +644,12 @@ static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb)
 	struct MessageUnit_F __iomem *pmuF;
 
 	memset(acb->dma_coherent2, 0xff, acb->completeQ_size);
-	acb->message_wbuffer = (uint32_t *)((((unsigned long)acb->dma_coherent2 +
-		acb->completeQ_size + 3) >> 2) << 2);
+	acb->message_wbuffer = (uint32_t *)round_up((unsigned long)acb->dma_coherent2 +
+		acb->completeQ_size, 4);
 	acb->message_rbuffer = ((void *)acb->message_wbuffer) + 0x100;
 	acb->msgcode_rwbuffer = ((void *)acb->message_wbuffer) + 0x200;
 	memset((void *)acb->message_wbuffer, 0, MESG_RW_BUFFER_SIZE);
-	host_buffer_dma = ((acb->dma_coherent_handle2 + acb->completeQ_size +
-		3) >> 2) << 2;
+	host_buffer_dma = round_up(acb->dma_coherent_handle2 + acb->completeQ_size, 4);
 	pmuF = acb->pmuF;
 	/* host buffer low address, bit0:1 all buffer active */
 	writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ