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: <20230412052133epcms2p4d52e78b4fc1bc6ac1cc9d399a0378fce@epcms2p4>
Date:   Wed, 12 Apr 2023 14:21:33 +0900
From:   Jinyoung CHOI <j-young.choi@...sung.com>
To:     "kbusch@...nel.org" <kbusch@...nel.org>,
        "axboe@...com" <axboe@...com>, "hch@....de" <hch@....de>,
        "sagi@...mberg.me" <sagi@...mberg.me>,
        "chaitanya.kulkarni@....com" <chaitanya.kulkarni@....com>,
        "linux-nvme@...ts.infradead.org" <linux-nvme@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper

This provides a nice shortcut to get the size of the integrity data
for the driver like NVMe that only support a single integrity segment.

Signed-off-by: Jinyoung Choi <j-young.choi@...sung.com>
---
 include/linux/blk-integrity.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index 378b2459efe2..abf1923f4aa5 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -114,6 +114,13 @@ static inline struct bio_vec *rq_integrity_vec(struct request *rq)
 		return NULL;
 	return rq->bio->bi_integrity->bip_vec;
 }
+
+static inline unsigned int rq_integrity_payload_size(struct request *rq)
+{
+	if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
+		return 0;
+	return rq->bio->bi_integrity->bip_iter.bi_size;
+}
 #else /* CONFIG_BLK_DEV_INTEGRITY */
 static inline int blk_rq_count_integrity_sg(struct request_queue *q,
 					    struct bio *b)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ