[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210325212609.492188-9-satyat@google.com>
Date: Thu, 25 Mar 2021 21:26:09 +0000
From: Satya Tangirala <satyat@...gle.com>
To: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>, Eric Biggers <ebiggers@...gle.com>,
Satya Tangirala <satyat@...gle.com>
Subject: [PATCH v2 8/8] block: add WARN() in bio_split() for sector alignment
The number of sectors passed to bio_split() should be aligned to
bio_required_sector_alignment(). All callers (other than bounce.c) have
been updated to ensure this, so add a WARN() if the number of sectors is
not aligned. (bounce.c was not updated since it's legacy code that
won't interact with inline encryption).
Signed-off-by: Satya Tangirala <satyat@...gle.com>
---
block/bio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/bio.c b/block/bio.c
index 26b7f721cda8..cb348f134a15 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1458,6 +1458,7 @@ struct bio *bio_split(struct bio *bio, int sectors,
BUG_ON(sectors <= 0);
BUG_ON(sectors >= bio_sectors(bio));
+ WARN_ON(!IS_ALIGNED(sectors, bio_required_sector_alignment(bio)));
/* Zone append commands cannot be split */
if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND))
--
2.31.0.291.g576ba9dcdaf-goog
Powered by blists - more mailing lists