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-next>] [day] [month] [year] [list]
Message-Id: <20190624160933.23148-1-marcos.souza.org@gmail.com>
Date:   Mon, 24 Jun 2019 13:09:33 -0300
From:   Marcos Paulo de Souza <marcos.souza.org@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Marcos Paulo de Souza <marcos.souza.org@...il.com>,
        Marcos Paulo de Souza <mpdesouza@...e.com>,
        Josef Bacik <josef@...icpanda.com>,
        Jens Axboe <axboe@...nel.dk>,
        linux-block@...r.kernel.org (open list:NETWORK BLOCK DEVICE (NBD)),
        nbd@...er.debian.org (open list:NETWORK BLOCK DEVICE (NBD))
Subject: [PATCH] driver: block: nbd: Replace magic number 9 with SECTOR_SHIFT

set_capacity expects the disk size in sectors of 512 bytes, and changing
the magic number 9 to SECTOR_SHIFT clarifies this intent.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3a9bca3aa093..fd3bc061c600 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -288,7 +288,7 @@ static void nbd_size_update(struct nbd_device *nbd)
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, config->blksize);
 	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
-	set_capacity(nbd->disk, config->bytesize >> 9);
+	set_capacity(nbd->disk, config->bytesize >> SECTOR_SHIFT);
 	if (bdev) {
 		if (bdev->bd_disk) {
 			bd_set_size(bdev, config->bytesize);
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ