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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 15 Jun 2022 12:19:17 +0200
From:   Pankaj Raghav <p.raghav@...sung.com>
To:     hch@....de, snitzer@...hat.com, damien.lemoal@...nsource.wdc.com,
        axboe@...nel.dk
Cc:     bvanassche@....org, linux-kernel@...r.kernel.org,
        jiangbo.365@...edance.com, hare@...e.de, pankydev8@...il.com,
        dm-devel@...hat.com, jonathan.derrick@...ux.dev,
        gost.dev@...sung.com, dsterba@...e.com, jaegeuk@...nel.org,
        linux-nvme@...ts.infradead.org, Johannes.Thumshirn@....com,
        linux-block@...r.kernel.org, Pankaj Raghav <p.raghav@...sung.com>,
        Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH v7 10/13] dm-table: use bdev_is_zone_start helper in
 device_area_is_invalid()

Use bdev_is_zone_start() helper that uses generic calculation to check
for zone alignment instead of using po2 based alignment check.

Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
---
 drivers/md/dm-table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index bd539afbf..b553cdb6d 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -251,7 +251,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 	if (bdev_is_zoned(bdev)) {
 		unsigned int zone_sectors = bdev_zone_sectors(bdev);
 
-		if (start & (zone_sectors - 1)) {
+		if (blk_queue_is_zone_start(bdev_get_queue(bdev), start)) {
 			DMWARN("%s: start=%llu not aligned to h/w zone size %u of %pg",
 			       dm_device_name(ti->table->md),
 			       (unsigned long long)start,
@@ -268,7 +268,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 		 * devices do not end up with a smaller zone in the middle of
 		 * the sector range.
 		 */
-		if (len & (zone_sectors - 1)) {
+		if (blk_queue_is_zone_start(bdev_get_queue(bdev), len)) {
 			DMWARN("%s: len=%llu not aligned to h/w zone size %u of %pg",
 			       dm_device_name(ti->table->md),
 			       (unsigned long long)len,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ