If all the bytes are equal to DISCARD_FILLER, we want to accept the buffer. If any of the bytes is different, we must do thorough tag-by-tag checking. The condition was inverted. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> Fixes: 84597a44a9d8 ("dm integrity: add optional discard support") -- drivers/md/dm-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6/drivers/md/dm-integrity.c =================================================================== --- linux-2.6.orig/drivers/md/dm-integrity.c 2020-04-03 18:48:39.000000000 +0200 +++ linux-2.6/drivers/md/dm-integrity.c 2020-04-03 18:51:38.000000000 +0200 @@ -1333,7 +1333,7 @@ static int dm_integrity_rw_tag(struct dm 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 { -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel