public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Bradshaw <sbradshaw@micron.com>
To: <martin.petersen@oracle.com>, <axboe@kernel.dk>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function
Date: Wed, 14 Jan 2015 11:47:48 -0800	[thread overview]
Message-ID: <54B6C7E4.6010002@micron.com> (raw)

The prot_buf pointer passed to the generate/verify functions is 
incorrect for the second and subsequent range, making it impossible 
to verify the guard tag.  The patch correctly increments the prot_buf 
pointer by the tuple size for each pass.

Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
---
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 5cbd5d9..c7cbf60 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -226,13 +226,13 @@ static int bio_integrity_process(struct bio *bio,
 	iter.disk_name = bio->bi_bdev->bd_disk->disk_name;
 	iter.interval = bi->interval;
 	iter.seed = bip_get_seed(bip);
-	iter.prot_buf = prot_buf;
 
 	bio_for_each_segment(bv, bio, bviter) {
 		void *kaddr = kmap_atomic(bv.bv_page);
 
 		iter.data_buf = kaddr + bv.bv_offset;
 		iter.data_size = bv.bv_len;
+		iter.prot_buf = prot_buf;
 
 		ret = proc_fn(&iter);
 		if (ret) {
@@ -241,6 +241,7 @@ static int bio_integrity_process(struct bio *bio,
 		}
 
 		kunmap_atomic(kaddr);
+		prot_buf += bi->tuple_size;
 	}
 	return ret;
 }

             reply	other threads:[~2015-01-14 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 19:47 Sam Bradshaw [this message]
2015-01-14 20:22 ` [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B6C7E4.6010002@micron.com \
    --to=sbradshaw@micron.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox