add boundary check for settings
This commit is contained in:
parent
43d34d39e8
commit
ac72a4fa68
39
add-boundary-check-for-settings.patch
Normal file
39
add-boundary-check-for-settings.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From abf36bf0351efde388c089245aed9f6d8d2e6d3b Mon Sep 17 00:00:00 2001
|
||||||
|
From: luckky <guodashun1@huawei.com>
|
||||||
|
Date: Wed, 6 Nov 2024 11:42:53 +0800
|
||||||
|
Subject: [PATCH] add boundary check for settings
|
||||||
|
1. add two boundary checks for page_isolation_threshold and hbm_online_repair_log_level
|
||||||
|
(0 <= page_isolation_threshold)
|
||||||
|
(0(LOG_DEBUG) <= hbm_online_repair_log_level <= 3(LOG_ERROR))
|
||||||
|
|
||||||
|
---
|
||||||
|
src/c/hbm_online_repair/hbm_online_repair.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/c/hbm_online_repair/hbm_online_repair.c b/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
index 943f201..00c9c0b 100644
|
||||||
|
--- a/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
+++ b/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
@@ -89,6 +89,9 @@ void hbm_param_init(void)
|
||||||
|
if (ret < 0) {
|
||||||
|
global_level_setting = DEFAULT_LOG_LEVEL;
|
||||||
|
log(LOG_WARNING, "Get log level from config failed, set the default value %d\n", DEFAULT_LOG_LEVEL);
|
||||||
|
+ } else if (global_level_setting < LOG_DEBUG || global_level_setting > LOG_ERROR) {
|
||||||
|
+ log(LOG_WARNING, "The log level value %d in config is out of range, set the default value %d\n", global_level_setting, DEFAULT_LOG_LEVEL);
|
||||||
|
+ global_level_setting = DEFAULT_LOG_LEVEL;
|
||||||
|
} else {
|
||||||
|
log(LOG_INFO, "log level: %d\n", global_level_setting);
|
||||||
|
}
|
||||||
|
@@ -98,6 +101,9 @@ void hbm_param_init(void)
|
||||||
|
if (ret < 0) {
|
||||||
|
page_isolation_threshold = DEFAULT_PAGE_ISOLATION_THRESHOLD;
|
||||||
|
log(LOG_WARNING, "Get page_isolation_threshold from config failed, set the default value %d\n", DEFAULT_PAGE_ISOLATION_THRESHOLD);
|
||||||
|
+ } else if (page_isolation_threshold < 0) {
|
||||||
|
+ log(LOG_WARNING, "The page_isolation_threshold %d in config is out of range, set the default value %d\n", page_isolation_threshold, DEFAULT_PAGE_ISOLATION_THRESHOLD);
|
||||||
|
+ page_isolation_threshold = DEFAULT_PAGE_ISOLATION_THRESHOLD;
|
||||||
|
} else {
|
||||||
|
log(LOG_INFO, "page_isolation_threshold: %d\n", page_isolation_threshold);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
Summary: System Inspection Framework
|
Summary: System Inspection Framework
|
||||||
Name: sysSentry
|
Name: sysSentry
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 20
|
Release: 21
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||||
@ -31,6 +31,7 @@ Patch18: fix-hbm-online-repair-notice-and-efi-create.patch
|
|||||||
Patch19: fix-uint8-bug-and-change-isolation-default-value.patch
|
Patch19: fix-uint8-bug-and-change-isolation-default-value.patch
|
||||||
Patch20: fix-write-file-return-code-bug.patch
|
Patch20: fix-write-file-return-code-bug.patch
|
||||||
Patch21: update-the-commit-of-the-log-level-and-format-of-sys.patch
|
Patch21: update-the-commit-of-the-log-level-and-format-of-sys.patch
|
||||||
|
Patch22: add-boundary-check-for-settings.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc-c++
|
BuildRequires: cmake gcc-c++
|
||||||
BuildRequires: python3 python3-setuptools
|
BuildRequires: python3 python3-setuptools
|
||||||
@ -220,6 +221,12 @@ rm -rf %{buildroot}
|
|||||||
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
|
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 6 2024 luckky <guodashun1@huawei.com> - 1.0.2-21
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: add boundary check for settings
|
||||||
|
|
||||||
* Tue Nov 5 2024 luckky <guodashun1@huawei.com> - 1.0.2-20
|
* Tue Nov 5 2024 luckky <guodashun1@huawei.com> - 1.0.2-20
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user