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>
47 lines
1.1 KiB
Diff
47 lines
1.1 KiB
Diff
From 6984814b6fd879efae178acb057c1025aa4c64e8 Mon Sep 17 00:00:00 2001
|
|
From: Xiao Ni <xni@redhat.com>
|
|
Date: Fri, 26 Jul 2024 15:14:11 +0800
|
|
Subject: [PATCH 145/201] mdadm/mdstat: fix coverity issue CHECKED_RETURN
|
|
|
|
It needs to check return values when functions return value.
|
|
|
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
---
|
|
mdstat.c | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/mdstat.c b/mdstat.c
|
|
index cbbace3d..a971a957 100644
|
|
--- a/mdstat.c
|
|
+++ b/mdstat.c
|
|
@@ -194,8 +194,11 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|
f = fopen("/proc/mdstat", "r");
|
|
if (f == NULL)
|
|
return NULL;
|
|
- else
|
|
- fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
|
+
|
|
+ if (fcntl(fileno(f), F_SETFD, FD_CLOEXEC) < 0) {
|
|
+ fclose(f);
|
|
+ return NULL;
|
|
+ }
|
|
|
|
all = NULL;
|
|
end = &all;
|
|
@@ -329,7 +332,10 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|
}
|
|
if (hold && mdstat_fd == -1) {
|
|
mdstat_fd = dup(fileno(f));
|
|
- fcntl(mdstat_fd, F_SETFD, FD_CLOEXEC);
|
|
+ if (fcntl(mdstat_fd, F_SETFD, FD_CLOEXEC) < 0) {
|
|
+ fclose(f);
|
|
+ return NULL;
|
|
+ }
|
|
}
|
|
fclose(f);
|
|
|
|
--
|
|
2.41.0
|
|
|