From 0fe147f30031154d43f6a504874bdce1d77047e2 Mon Sep 17 00:00:00 2001
From: Yihang Li <liyihang9@h-partners.com>
Date: Thu, 7 Aug 2025 16:06:10 +0800
Subject: [PATCH 8/9] sysSentry: Fix two code review comments
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/sysSentry/issues/ID1UOY
CVE: NA
Fix two code review comments:
a. When a uint64_t type loop_cnt is passed as a parameter to an int type,
truncation occurs. To resolve this issue, the parameter type is changed
to uint64_t.
b. The loop counter loop_cnt is of type uint64_t. When it increments to
its maximum value and then adds 1, it overflows to 0, causing an infinite
loop that cannot be exited. To address this problem, a loop condition is
added to ensure that the loop continues only if loop_cnt does not overflow
to 0 after incrementing.
Signed-off-by: Yihang Li <liyihang9@h-partners.com>
Signed-off-by: Qizhi Zhang <zhangqizhi3@h-partners.com>
src/sentryPlugins/soc_ring_sentry/tc_ring_one.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -641,7 +641,7 @@ static bool tc_ring_one_scan_bit(struct tc_ring_one_config *config, int scan_bit
return true;
}
-static bool tc_ring_one_test_issue(struct tc_ring_one_config *config, int scan_bit, int loop_cnt)
+static bool tc_ring_one_test_issue(struct tc_ring_one_config *config, int scan_bit, uint64_t loop_cnt)
{
bool ret;
--
2.33.0