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: <20211126125533.266015-1-Niklas.Cassel@wdc.com>
Date:   Fri, 26 Nov 2021 12:55:59 +0000
From:   Niklas Cassel <Niklas.Cassel@....com>
To:     "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
CC:     "damien.lemoal@...nsource.wdc.com" <damien.lemoal@...nsource.wdc.com>,
        Niklas Cassel <Niklas.Cassel@....com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] scsi: sd_zbc: Compare against block layer enum values

From: Niklas Cassel <niklas.cassel@....com>

sd_zbc_parse_report() fills in a struct blk_zone, which is the block layer
representation of a zone. This struct is also what will be copied to user
for a BLKREPORTZONE ioctl.

Since sd_zbc_parse_report() compares against zone.type and zone.cond, which
are members of a struct blk_zone, the correct enum values to compare
against are the enum values defined by the block layer.

These specific enum values for ZBC and the block layer happen to have the
same enum constants, but they could theoretically have been different.

Compare against the block layer enum values, to make it more obvious that
struct blk_zone is the block layer representation of a zone, and not the
SCSI/ZBC representation of a zone.

Signed-off-by: Niklas Cassel <niklas.cassel@....com>
---
 drivers/scsi/sd_zbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index ed06798983f8..024f1bec6e5a 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -62,8 +62,8 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
 	zone.capacity = zone.len;
 	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
 	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
-	if (zone.type != ZBC_ZONE_TYPE_CONV &&
-	    zone.cond == ZBC_ZONE_COND_FULL)
+	if (zone.type != BLK_ZONE_TYPE_CONVENTIONAL &&
+	    zone.cond == BLK_ZONE_COND_FULL)
 		zone.wp = zone.start + zone.len;
 
 	ret = cb(&zone, idx, data);
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ