diff options
author | Xiao Ni <xni@redhat.com> | 2024-07-26 09:14:15 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-08-05 11:14:18 +0200 |
commit | 38f712dba339bb9bd6a73cc7219d217871e7f27a (patch) | |
tree | a6dab9aee11e09c1858b0758b2aac53280cf4b3a | |
parent | mdadm/super1: fix coverity issue DEADCODE (diff) | |
download | mdadm-38f712dba339bb9bd6a73cc7219d217871e7f27a.tar.xz mdadm-38f712dba339bb9bd6a73cc7219d217871e7f27a.zip |
mdadm/super1: fix coverity issue EVALUATION_ORDER
Fix evaluation order problems in super1.c
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
-rw-r--r-- | super1.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -340,6 +340,9 @@ static void examine_super1(struct supertype *st, char *homehost) unsigned long long sb_offset; struct mdinfo info; int inconsistent = 0; + unsigned int expected_csum = 0; + + expected_csum = calc_sb_1_csum(sb); printf(" Magic : %08x\n", __le32_to_cpu(sb->magic)); printf(" Version : 1"); @@ -507,13 +510,13 @@ static void examine_super1(struct supertype *st, char *homehost) printf("\n"); } - if (calc_sb_1_csum(sb) == sb->sb_csum) + if (expected_csum == sb->sb_csum) printf(" Checksum : %x - correct\n", __le32_to_cpu(sb->sb_csum)); else printf(" Checksum : %x - expected %x\n", __le32_to_cpu(sb->sb_csum), - __le32_to_cpu(calc_sb_1_csum(sb))); + __le32_to_cpu(expected_csum)); printf(" Events : %llu\n", (unsigned long long)__le64_to_cpu(sb->events)); printf("\n"); |