]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm-integrity: don't increment hash_offset twice
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 9 Jul 2026 19:24:09 +0000 (21:24 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Fri, 10 Jul 2026 12:39:16 +0000 (14:39 +0200)
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 <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-4.6
Fixes: 84597a44a9d8 ("dm-integrity: dm integrity: add optional discard support")
Cc: stable@vger.kernel.org
drivers/md/dm-integrity.c

index 02b2805ed33ad829caa7255e71b75a464d7b5c2e..f5508b1bca11d35926946417e0cd6cd6b32e898d 100644 (file)
@@ -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));