1 Star 0 Fork 27

znzjugod / rasdaemon

forked from src-openEuler / rasdaemon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-rasdaemon-ras-memory-failure-handler-handle-localtim.patch 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
renxichen 提交于 2023-03-24 09:47 . backport patches from upstream
From ce33041e0abfa20054ff5d6874ffbd1ab592558d 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-memory-failure-handler: handle localtime()
failure correctly
We could just have an empty string but keeping the format could prevent
issues if someone is actually parsing this.
Found with covscan.
v2: fixed the timestamp as pointed by Robert Elliott
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-memory-failure-handler.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
index 9941e68..1951456 100644
--- a/ras-memory-failure-handler.c
+++ b/ras-memory-failure-handler.c
@@ -148,6 +148,8 @@ int ras_memory_failure_event_handler(struct trace_seq *s,
if (tm)
strftime(ev.timestamp, sizeof(ev.timestamp),
"%Y-%m-%d %H:%M:%S %z", tm);
+ else
+ strncpy(ev.timestamp, "1970-01-01 00:00:00 +0000", sizeof(ev.timestamp));
trace_seq_printf(s, "%s ", ev.timestamp);
if (pevent_get_field_val(s, event, "pfn", record, &val, 1) < 0)
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/znzjugod/rasdaemon.git
git@gitee.com:znzjugod/rasdaemon.git
znzjugod
rasdaemon
rasdaemon
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891