mdadm/0114-mdadm-Build.c-fix-coverity-issues.patch

41 lines
1.1 KiB
Diff
Raw Permalink Normal View History

From 0244bac0a828e69aef36404437cac4ff148eaea0 Mon Sep 17 00:00:00 2001
From: Nigel Croxon <ncroxon@redhat.com>
Date: Tue, 2 Jul 2024 09:49:13 -0400
Subject: [PATCH 114/201] mdadm: Build.c fix coverity issues
Event leaked_handle: Handle variable "bitmap_fd" going out of
scope leaks the handle.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
---
Build.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Build.c b/Build.c
index 1be90e41..052b1bc2 100644
--- a/Build.c
+++ b/Build.c
@@ -168,13 +168,13 @@ int Build(struct mddev_ident *ident, struct mddev_dev *devlist, struct shape *s,
goto abort;
}
}
- if (bitmap_fd >= 0) {
- if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) {
- pr_err("Cannot set bitmap file for %s: %s\n", chosen_name,
- strerror(errno));
- goto abort;
- }
+ if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) {
+ pr_err("Cannot set bitmap file for %s: %s\n", chosen_name,
+ strerror(errno));
+ close(bitmap_fd);
+ goto abort;
}
+ close(bitmap_fd);
}
if (ioctl(mdfd, RUN_ARRAY, &param)) {
pr_err("RUN_ARRAY failed: %s\n", strerror(errno));
--
2.41.0