]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm integrity: fix gcc 5 warning
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 3 Sep 2024 09:50:11 +0000 (11:50 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 3 Sep 2024 10:08:20 +0000 (12:08 +0200)
This commit fixes gcc 5 warning "logical not is only applied to the left
hand side of comparison"

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: fb0987682c62 ("dm-integrity: introduce the Inline mode")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-integrity.c

index 8306f8511078b2a335d8058b830456f0a0f9ccb7..b3489d3fe7db1dbcc0a8348c13aa6df6cf400cec 100644 (file)
@@ -4715,13 +4715,18 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
                ti->error = "Block size doesn't match the information in superblock";
                goto bad;
        }
-       if (!le32_to_cpu(ic->sb->journal_sections) != (ic->mode == 'I')) {
-               r = -EINVAL;
-               if (ic->mode != 'I')
+       if (ic->mode != 'I') {
+               if (!le32_to_cpu(ic->sb->journal_sections)) {
+                       r = -EINVAL;
                        ti->error = "Corrupted superblock, journal_sections is 0";
-               else
+                       goto bad;
+               }
+       } else {
+               if (le32_to_cpu(ic->sb->journal_sections)) {
+                       r = -EINVAL;
                        ti->error = "Corrupted superblock, journal_sections is not 0";
-               goto bad;
+                       goto bad;
+               }
        }
        /* make sure that ti->max_io_len doesn't overflow */
        if (!ic->meta_dev) {