Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm-integrity: duplicate recalculation check block in
  dm_integrity_resume()
--

commit 7fbe3dddd5b741b0cbacdf50c00c5c1e5e6e0bc0
Author: Yang Luohan <[email protected]>

dm-integrity: reject recalculation when recalc_wq was never allocated

This commit rejects a re-read superblock in dm_integrity_resume() when
SB_FLAG_RECALCULATING is set but ic->recalc_wq was not allocated, restoring
ic->sb from ic->sb_copy.

> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 6968e38888db9..da8d15aa414ed 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -3941,6 +3941,22 @@ static void dm_integrity_resume(struct dm_target *ti)
>               goto skip_writes;
>       }
>  
> +     if (unlikely(!ic->recalc_wq &&
> +                  (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)))) {
> +             memcpy(ic->sb, ic->sb_copy, sizeof(struct superblock));
> +             DMERR("Recalculate requested, but internal_hash is not used");
> +             dm_integrity_io_error(ic, "inconsistent superblock", -EINVAL);
> +             goto skip_writes;
> +     }
> +
> +     if (unlikely(!ic->recalc_wq &&
> +                  (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)))) {
> +             memcpy(ic->sb, ic->sb_copy, sizeof(struct superblock));
> +             DMERR("Recalculate requested, but internal_hash is not used");
> +             dm_integrity_io_error(ic, "inconsistent superblock", -EINVAL);
> +             goto skip_writes;
> +     }

[Severity: Low]
Was this check pasted twice by mistake?  The first block jumps to
skip_writes when the condition holds, so the second copy is dead code.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to