From: Xiao Ni <xni@redhat.com>
To: mariusz.tkaczyk@linux.intel.com
Cc: ncroxon@redhat.com, linux-raid@vger.kernel.org
Subject: [PATCH 13/14] mdadm/super1: fix coverity issue EVALUATION_ORDER
Date: Fri, 19 Jul 2024 17:52:18 +0800 [thread overview]
Message-ID: <20240719095219.9705-14-xni@redhat.com> (raw)
In-Reply-To: <20240719095219.9705-1-xni@redhat.com>
Signed-off-by: Xiao Ni <xni@redhat.com>
---
super1.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/super1.c b/super1.c
index 24bc1026..243eeb1a 100644
--- a/super1.c
+++ b/super1.c
@@ -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");
--
2.41.0
next prev parent reply other threads:[~2024-07-19 9:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 9:52 [PATCH V2 00/14] mdadm: fix coverity issues Xiao Ni
2024-07-19 9:52 ` [PATCH 01/14] mdadm/Grow: fix coverity issue CHECKED_RETURN Xiao Ni
2024-07-19 9:52 ` [PATCH 02/14] mdadm/Grow: fix coverity issue RESOURCE_LEAK Xiao Ni
2024-07-19 9:52 ` [PATCH 03/14] mdadm/Grow: fix coverity issue STRING_OVERFLOW Xiao Ni
2024-07-19 9:52 ` [PATCH 04/14] mdadm/Incremental: fix coverity issues Xiao Ni
2024-07-19 9:52 ` [PATCH 05/14] mdadm/mdmon: fix coverity issue CHECKED_RETURN Xiao Ni
2024-07-19 9:52 ` [PATCH 06/14] mdadm/mdmon: fix coverity issue RESOURCE_LEAK Xiao Ni
2024-07-19 9:52 ` [PATCH 07/14] mdadm/mdopen: fix coverity issue CHECKED_RETURN Xiao Ni
2024-07-19 9:52 ` [PATCH 08/14] mdadm/mdopen: fix coverity issue STRING_OVERFLOW Xiao Ni
2024-07-19 9:52 ` [PATCH 09/14] mdadm/mdstat: fix coverity issue CHECKED_RETURN Xiao Ni
2024-07-19 9:52 ` [PATCH 10/14] mdadm/super0: fix coverity issue CHECKED_RETURN and EVALUATION_ORDER Xiao Ni
2024-07-19 9:52 ` [PATCH 11/14] mdadm/super1: fix coverity issue CHECKED_RETURN Xiao Ni
2024-07-19 9:52 ` [PATCH 12/14] mdadm/super1: fix coverity issue DEADCODE Xiao Ni
2024-07-19 9:52 ` Xiao Ni [this message]
2024-07-19 9:52 ` [PATCH 14/14] mdadm/super1: fix coverity issue RESOURCE_LEAK Xiao Ni
-- strict thread matches above, loose matches on Subject: below --
2024-07-22 8:17 [PATCH V3 00/14] mdadm: fix coverity issues Xiao Ni
2024-07-22 8:17 ` [PATCH 13/14] mdadm/super1: fix coverity issue EVALUATION_ORDER Xiao Ni
2024-07-26 7:14 [PATCH V4 00/14] mdadm: fix coverity issues Xiao Ni
2024-07-26 7:14 ` [PATCH 13/14] mdadm/super1: fix coverity issue EVALUATION_ORDER Xiao Ni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240719095219.9705-14-xni@redhat.com \
--to=xni@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=ncroxon@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).