!56 [sync] PR-55: rasdaemon: Fix startup core dumped issue.

From: @openeuler-sync-bot 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
This commit is contained in:
openeuler-ci-bot 2022-11-28 07:20:20 +00:00 committed by Gitee
commit f2d21454d9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From: Xiaofei Tan <tanxiaofei@huawei.com>
Date: Sat, 20 Aug 2022 09:49:25 +0000
Subject: [PATCH] rasdaemon: use standard length PATH_MAX for path name
Use standard length PATH_MAX for path name space allocation
to replace the macro MAX_PATH_LEN.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
ras-cpu-isolation.c | 6 +++---
ras-cpu-isolation.h | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/ras-cpu-isolation.c b/ras-cpu-isolation.c
index ba5ccd1..24c07e9 100644
--- a/ras-cpu-isolation.c
+++ b/ras-cpu-isolation.c
@@ -80,11 +80,11 @@ static const char * const cpu_state[] = {
static int open_sys_file(unsigned int cpu, int __oflag, const char *format)
{
int fd;
- char path[MAX_PATH_LEN + 1] = "";
- char real_path[MAX_PATH_LEN + 1] = "";
+ char path[PATH_MAX] = "";
+ char real_path[PATH_MAX] = "";
snprintf(path, sizeof(path), format, cpu);
- if (strlen(path) > MAX_PATH_LEN || realpath(path, real_path) == NULL) {
+ if (strlen(path) > PATH_MAX || realpath(path, real_path) == NULL) {
log(TERM, LOG_ERR, "[%s]:open file: %s failed\n", __func__, path);
return -1;
}
diff --git a/ras-cpu-isolation.h b/ras-cpu-isolation.h
index 024a68b..5682106 100644
--- a/ras-cpu-isolation.h
+++ b/ras-cpu-isolation.h
@@ -17,7 +17,6 @@
#include "queue.h"
-#define MAX_PATH_LEN 100
#define MAX_BUF_LEN 1024
struct param {
--
2.17.1

View File

@ -1,6 +1,6 @@
Name: rasdaemon
Version: 0.6.7
Release: 5
Release: 6
License: GPLv2
Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events
URL: https://github.com/mchehab/rasdaemon.git
@ -37,6 +37,7 @@ Patch15: 0007-rasdaemon-ras-mc-ctl-Add-support-to-display-the-HiSi.patch
Patch16: 0008-rasdaemon-ras-mc-ctl-Relocate-reading-and-display-Ku.patch
Patch17: 0009-rasdaemon-ras-mc-ctl-Updated-HiSilicon-platform-name.patch
Patch18: 0010-rasdaemon-Fix-for-a-memory-out-of-bounds-issue-and-o.patch
Patch19: 0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch
%description
The rasdaemon program is a daemon which monitors the platform
@ -82,6 +83,14 @@ rm INSTALL %{buildroot}/usr/include/*.h
/usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || :
%changelog
* Thu Aug 25 2022 Xiaofei Tan <tanxiaofei@huawei.com> - 0.6.7-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:
Add the following patch to fix startup core dumped issue.
0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch
* Mon May 23 2022 Shiju Jose<shiju.jose@huawei.com> - 0.6.7-5
- Type:feature
- ID:NA