f1b7707f26
For issue RHEL-40729, patch 0142 fixes it. For issue RHEL-31448, patch 0125 fixes it. Resolves: RHEL-31448,RHEL-40729,RHEL-52059 Signed-off-by: Xiao Ni <xni@redhat.com>
57 lines
1.8 KiB
Diff
57 lines
1.8 KiB
Diff
From e055d9236a7d0dca2a311e8bb8013018dc571d6a Mon Sep 17 00:00:00 2001
|
|
From: Xiao Ni <xni@redhat.com>
|
|
Date: Fri, 26 Jul 2024 15:14:12 +0800
|
|
Subject: [PATCH 146/201] mdadm/super0: fix coverity issue CHECKED_RETURN and
|
|
EVALUATION_ORDER
|
|
|
|
Fix coverity problems in super0. It needs to check return value when
|
|
functions return value. And fix EVALUATION_ORDER problems in super0.c
|
|
|
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
---
|
|
super0.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/super0.c b/super0.c
|
|
index 9b4e187e..c428e2a6 100644
|
|
--- a/super0.c
|
|
+++ b/super0.c
|
|
@@ -83,6 +83,9 @@ static void examine_super0(struct supertype *st, char *homehost)
|
|
int d;
|
|
int delta_extra = 0;
|
|
char *c;
|
|
+ unsigned long expected_csum = 0;
|
|
+
|
|
+ expected_csum = calc_sb0_csum(sb);
|
|
|
|
printf(" Magic : %08x\n", sb->md_magic);
|
|
printf(" Version : %d.%02d.%02d\n",
|
|
@@ -187,11 +190,11 @@ static void examine_super0(struct supertype *st, char *homehost)
|
|
printf("Working Devices : %d\n", sb->working_disks);
|
|
printf(" Failed Devices : %d\n", sb->failed_disks);
|
|
printf(" Spare Devices : %d\n", sb->spare_disks);
|
|
- if (calc_sb0_csum(sb) == sb->sb_csum)
|
|
+ if (expected_csum == sb->sb_csum)
|
|
printf(" Checksum : %x - correct\n", sb->sb_csum);
|
|
else
|
|
printf(" Checksum : %x - expected %lx\n",
|
|
- sb->sb_csum, calc_sb0_csum(sb));
|
|
+ sb->sb_csum, expected_csum);
|
|
printf(" Events : %llu\n",
|
|
((unsigned long long)sb->events_hi << 32) + sb->events_lo);
|
|
printf("\n");
|
|
@@ -1212,7 +1215,8 @@ static int locate_bitmap0(struct supertype *st, int fd, int node_num)
|
|
|
|
offset += MD_SB_BYTES;
|
|
|
|
- lseek64(fd, offset, 0);
|
|
+ if (lseek64(fd, offset, 0) < 0)
|
|
+ return -1;
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.41.0
|
|
|