11 Star 3 Fork 32

src-openEuler/rasdaemon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-the-bug-that-config-env-is-greater-than-ulong_ma.patch 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
luckky 提交于 4个月前 . backport patches from upstream
From 683feacf378db0217b8ab421e0a694b0b68188c9 Mon Sep 17 00:00:00 2001
From: zhuofeng <zhuofeng2@huawei.com>
Date: Thu, 7 Dec 2023 14:37:50 +0800
Subject: [PATCH] Fix the bug that `config->env` is greater than `ulong_max`
when units->val=1
Reference:https://github.com/mchehab/rasdaemon/commit/683feacf378db0217b8ab421e0a694b0b68188c9
Conflict: NA
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
ras-page-isolation.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ras-page-isolation.c b/ras-page-isolation.c
index f074b45..341f2cf 100644
--- a/ras-page-isolation.c
+++ b/ras-page-isolation.c
@@ -188,6 +188,17 @@ parse:
value *= units->val;
if (tmp != 0 && value / tmp != units->val)
config->overflow = true;
+ /**
+ * if units->val is 1, config->env is greater than ulong_max, so it is can strtoul
+ * if failed, the value is greater than ulong_max, set config->overflow = true
+ */
+ if (units->val == 1) {
+ char *endptr;
+ unsigned long converted_value = strtoul(config->env, &endptr, 10);
+ if (errno == ERANGE || *endptr != '\0')
+ config->overflow = true;
+ }
+ unit_matched = 0;
}
}
config->val = value;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/rasdaemon.git
git@gitee.com:src-openeuler/rasdaemon.git
src-openeuler
rasdaemon
rasdaemon
master

搜索帮助

371d5123 14472233 46e8bd33 14472233