加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0027-mdadm-mdopen-fix-coverity-issue-CHECKED_RETURN.patch 918 Bytes
一键复制 编辑 原始数据 按行查看 历史
wguanghao 提交于 2024-08-26 15:49 . backport bugfix patches from community
From f34040081c36ff92180674b89c39ddc7bdd47288 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Fri, 26 Jul 2024 15:14:09 +0800
Subject: [PATCH] mdadm/mdopen: 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>
---
mdopen.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mdopen.c b/mdopen.c
index eaa59b59..c9fda131 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -406,7 +406,11 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
perror("chown");
if (chmod(devname, ci->mode))
perror("chmod");
- stat(devname, &stb);
+ if (stat(devname, &stb) < 0) {
+ pr_err("failed to stat %s\n",
+ devname);
+ return -1;
+ }
add_dev(devname, &stb, 0, NULL);
}
if (use_mdp == 1)
--
2.39.2
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化