mdadm/0124-mdadm-Query.c-fix-coverity-issues.patch
Xiao Ni aba27b5983 Update to latest upstream
Fix coverity issue 34533 and  /dev/md symlink not created for second RAID container
issue 50776

Resolves: RHEL-34533, RHEL50776

Signed-off-by: Xiao Ni <xni@redhat.com>
2024-08-10 23:06:32 -04:00

43 lines
1.0 KiB
Diff

From bcc3ab1728da61e5519e1f01597c8da0c5bc769b Mon Sep 17 00:00:00 2001
From: Nigel Croxon <ncroxon@redhat.com>
Date: Tue, 16 Jul 2024 07:19:34 -0400
Subject: [PATCH 124/157] mdadm: Query.c fix coverity issues
Fixing the following coding errors the coverity tools found:
* Event leaked_storage: Variable "sra" going out of scope leaks the
storage it points to.
* Event uninit_use_in_call: Using uninitialized value "larray_size" when
calling "human_size_brief".
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
---
Query.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Query.c b/Query.c
index adcd231e..aedb4ce7 100644
--- a/Query.c
+++ b/Query.c
@@ -39,7 +39,7 @@ int Query(char *dev)
struct mdinfo info;
struct mdinfo *sra;
struct supertype *st = NULL;
- unsigned long long larray_size;
+ unsigned long long larray_size = 0;
struct stat stb;
char *mddev;
mdu_disk_info_t disc;
@@ -136,5 +136,7 @@ int Query(char *dev)
if (st->ss == &super0)
put_md_name(mddev);
}
+ free(sra);
+
return 0;
}
--
2.41.0