If hash size is less than device's tuple size, dm-integrity is supposed
to zero the remaining space. There was a bug in the code that zeroing
didn't work. This commit fixes it.

Signed-off-by: Mikulas Patocka <[email protected]>
Assisted-by: Claude:claude-opus-4.6
Fixes: fb0987682c62 ("dm-integrity: introduce the Inline mode")
Cc: [email protected]

---
 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    2026-04-27 19:06:34.000000000 
+0200
+++ linux-2.6/drivers/md/dm-integrity.c 2026-06-22 16:33:32.000000000 +0200
@@ -2606,7 +2606,7 @@ skip_spinlock:
                        struct bio_vec bv = bio_iter_iovec(bio, 
dio->bio_details.bi_iter);
                        const char *mem = integrity_kmap(ic, bv.bv_page);
                        if (ic->tag_size < ic->tuple_size)
-                               memset(dio->integrity_payload + pos + 
ic->tag_size, 0, ic->tuple_size - ic->tuple_size);
+                               memset(dio->integrity_payload + pos + 
ic->tag_size, 0, ic->tuple_size - ic->tag_size);
                        integrity_sector_checksum(ic, &dio->ahash_req, 
dio->bio_details.bi_iter.bi_sector, mem, bv.bv_offset, dio->integrity_payload + 
pos);
                        integrity_kunmap(ic, mem);
                        pos += ic->tuple_size;


Reply via email to