hash_offset is already incremented in the loop "for (i = 0; i < to_copy;
i++, ts--)". Do not increment it again.

Signed-off-by: Mikulas Patocka <[email protected]>
Assisted-by: Claude:claude-opus-4.6
Fixes: 84597a44a9d8 ("dm-integrity: dm integrity: add optional discard support")
Cc: [email protected]

---
 drivers/md/dm-integrity.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c    2026-06-22 17:52:05.000000000 
+0200
+++ linux-2.6/drivers/md/dm-integrity.c 2026-06-29 17:58:14.000000000 +0200
@@ -1480,9 +1480,6 @@ thorough_test:
                        *metadata_offset = 0;
                }
 
-               if (unlikely(!is_power_of_2(ic->tag_size)))
-                       hash_offset = (hash_offset + to_copy) % ic->tag_size;
-
                total_size -= to_copy;
        } while (unlikely(total_size));
 


Reply via email to