diff mbox series

btt: fix block integrity

Message ID 20240830204255.4130362-1-kbusch@meta.com (mailing list archive)
State New
Headers show
Series btt: fix block integrity | expand

Commit Message

Keith Busch Aug. 30, 2024, 8:42 p.m. UTC
From: Keith Busch <kbusch@kernel.org>

bip is NULL before bio_integrity_prep().

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvdimm/btt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dave Jiang Sept. 3, 2024, 3:47 p.m. UTC | #1
On 8/30/24 1:42 PM, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> bip is NULL before bio_integrity_prep().
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/nvdimm/btt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index 423dcd1909061..13594fb712186 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -1435,8 +1435,8 @@ static int btt_do_bvec(struct btt *btt, struct bio_integrity_payload *bip,
>  
>  static void btt_submit_bio(struct bio *bio)
>  {
> -	struct bio_integrity_payload *bip = bio_integrity(bio);
>  	struct btt *btt = bio->bi_bdev->bd_disk->private_data;
> +	struct bio_integrity_payload *bip;
>  	struct bvec_iter iter;
>  	unsigned long start;
>  	struct bio_vec bvec;
> @@ -1445,6 +1445,7 @@ static void btt_submit_bio(struct bio *bio)
>  
>  	if (!bio_integrity_prep(bio))
>  		return;
> +	bip = bio_integrity(bio);
>  
>  	do_acct = blk_queue_io_stat(bio->bi_bdev->bd_disk->queue);
>  	if (do_acct)
diff mbox series

Patch

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 423dcd1909061..13594fb712186 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1435,8 +1435,8 @@  static int btt_do_bvec(struct btt *btt, struct bio_integrity_payload *bip,
 
 static void btt_submit_bio(struct bio *bio)
 {
-	struct bio_integrity_payload *bip = bio_integrity(bio);
 	struct btt *btt = bio->bi_bdev->bd_disk->private_data;
+	struct bio_integrity_payload *bip;
 	struct bvec_iter iter;
 	unsigned long start;
 	struct bio_vec bvec;
@@ -1445,6 +1445,7 @@  static void btt_submit_bio(struct bio *bio)
 
 	if (!bio_integrity_prep(bio))
 		return;
+	bip = bio_integrity(bio);
 
 	do_acct = blk_queue_io_stat(bio->bi_bdev->bd_disk->queue);
 	if (do_acct)