summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2020-04-03 19:05:50 +0200
committerMike Snitzer <snitzer@redhat.com>2020-04-03 19:07:41 +0200
commit8267d8fb4819afa76b2a54dca48efdda6f0b1910 (patch)
tree3462cb434ed814e3186fa90efdc51077dae36098 /drivers/md
parentRevert "dm: always call blk_queue_split() in dm_process_bio()" (diff)
downloadlinux-8267d8fb4819afa76b2a54dca48efdda6f0b1910.tar.xz
linux-8267d8fb4819afa76b2a54dca48efdda6f0b1910.zip
dm integrity: fix logic bug in integrity tag testing
If all the bytes are equal to DISCARD_FILLER, we want to accept the buffer. If any of the bytes are different, we must do thorough tag-by-tag checking. The condition was inverted. Fixes: 84597a44a9d8 ("dm integrity: add optional discard support") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-integrity.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 49fee5aecbc9..4094c47eca7f 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -1333,7 +1333,7 @@ static int dm_integrity_rw_tag(struct dm_integrity_c *ic, unsigned char *tag, se
if (likely(is_power_of_2(ic->tag_size))) {
if (unlikely(memcmp(dp, tag, to_copy)))
if (unlikely(!ic->discard) ||
- unlikely(!memchr_inv(dp, DISCARD_FILLER, to_copy))) {
+ unlikely(memchr_inv(dp, DISCARD_FILLER, to_copy) != NULL)) {
goto thorough_test;
}
} else {