代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/mdadm 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 4e9e7cc59fab61e16a93d0ae3b73e9b9b0001d4b Mon Sep 17 00:00:00 2001
From: Nigel Croxon <ncroxon@redhat.com>
Date: Mon, 15 Jul 2024 10:13:46 -0400
Subject: [PATCH] mdadm: Monitor.c fix coverity issues
Fixing the following coding errors the coverity tools found:
* Event check_return: Calling "fcntl(fd, 2, 1)" without checking
return value. This library function may fail and return an error code.
* Dereferencing "sl", which is known to be "NULL".
* Event fixed_size_dest: You might overrun the 32-character fixed-size
string "devnm" by copying "tmp" without checking the length.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
---
Monitor.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Monitor.c b/Monitor.c
index 9f1765d..4637729 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -570,7 +570,9 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
if (!is_container && !md_array_active(fd))
goto disappeared;
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto out;
+
if (md_get_array_info(fd, &array) < 0)
goto disappeared;
@@ -796,7 +798,8 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
strcpy(st->parent_devnm,
mse->metadata_version+10);
sl = strchr(st->parent_devnm, '/');
- *sl = 0;
+ if (sl)
+ *sl = 0;
} else
st->parent_devnm[0] = 0;
*statelist = st;
@@ -1135,7 +1138,7 @@ int Wait(char *dev)
return 2;
}
- strcpy(devnm, tmp);
+ snprintf(devnm, sizeof(devnm), "%s", tmp);
while(1) {
struct mdstat_ent *ms = mdstat_read(1, 0);
@@ -1206,7 +1209,8 @@ int WaitClean(char *dev, int verbose)
return 1;
}
- strcpy(devnm, fd2devnm(fd));
+ snprintf(devnm, sizeof(devnm), "%s", fd2devnm(fd));
+
mdi = sysfs_read(fd, devnm, GET_VERSION|GET_LEVEL|GET_SAFEMODE);
if (!mdi) {
if (verbose)
--
2.43.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。