1 Star 0 Fork 26

znzjugod / rasdaemon

forked from src-openEuler / rasdaemon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-rasdaemon-ras-report-fix-possible-but-unlikely-file-.patch 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
renxichen 提交于 2023-03-24 09:47 . backport patches from upstream
From 899fcc2cf21c86b5462c8f4441cd9c92b3d75f7d Mon Sep 17 00:00:00 2001
From: Aristeu Rozanski <arozansk@redhat.com>
Date: Thu, 19 Jan 2023 08:45:57 -0500
Subject: [PATCH] rasdaemon: ras-report: fix possible but unlikely file
descriptor leak
Found with covscan.
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-report.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ras-report.c b/ras-report.c
index ea3a9b6..62d5eb7 100644
--- a/ras-report.c
+++ b/ras-report.c
@@ -434,7 +434,7 @@ int ras_report_mc_event(struct ras_events *ras, struct ras_mc_event *ev){
mc_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -484,7 +484,7 @@ int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev){
aer_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -533,7 +533,7 @@ int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standar
non_standard_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -578,7 +578,7 @@ int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev){
arm_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -624,7 +624,7 @@ int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev){
mce_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -674,7 +674,7 @@ int ras_report_devlink_event(struct ras_events *ras, struct devlink_event *ev){
devlink_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -723,7 +723,7 @@ int ras_report_diskerror_event(struct ras_events *ras, struct diskerror_event *e
done = 1;
diskerror_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -768,7 +768,7 @@ int ras_report_mf_event(struct ras_events *ras, struct ras_mf_event *ev)
done = 1;
mf_fail:
- if (sockfd > 0)
+ if (sockfd >= 0)
close(sockfd);
if (done)
--
2.27.0
1
https://gitee.com/znzjugod/rasdaemon.git
git@gitee.com:znzjugod/rasdaemon.git
znzjugod
rasdaemon
rasdaemon
master

搜索帮助