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: <1480791233-21398-1-git-send-email-fabf@skynet.be>
Date:   Sat,  3 Dec 2016 19:53:53 +0100
From:   Fabian Frederick <fabf@...net.be>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     linux-nvdimm@...ts.01.org, linux-kernel@...r.kernel.org,
        fabf@...net.be
Subject: [PATCH V2 2/3 libnvdimm-pending] libnvdimm, namespace: avoid multiple sector calculations

Use sector_t for cleared

Suggested-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
V2: -applied on top of libnvdimm-pending

 drivers/nvdimm/pmem.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 0f47062..9edad8b 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -51,17 +51,16 @@ static int pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset,
 		unsigned int len)
 {
 	struct device *dev = to_dev(pmem);
-	sector_t sector;
-	long cleared;
+	sector_t sector, cleared;
 
 	sector = (offset - pmem->data_offset) / 512;
-	cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len);
+	cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len) / 512;
 
-	if (cleared > 0 && cleared / 512) {
+	if (cleared) {
 		dev_dbg(dev, "%s: %#llx clear %ld sector%s\n",
 				__func__, (unsigned long long) sector,
-				cleared / 512, cleared / 512 > 1 ? "s" : "");
-		badblocks_clear(&pmem->bb, sector, cleared / 512);
+				cleared, cleared > 1 ? "s" : "");
+		badblocks_clear(&pmem->bb, sector, cleared);
 	} else {
 		return -EIO;
 	}
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ