代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From c6de43f7e7cb866f8d5ddd453c73783d5daafca0 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Wed, 27 Dec 2023 12:22:06 +0800
Subject: [PATCH] fix func separate_str_to_array overflow problem
---
src/lstack/core/lstack_protocol_stack.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index b5d4ea3..f3d2452 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -651,44 +651,57 @@ int32_t stack_setup_thread(void)
struct thread_params *t_params[PROTOCOL_STACK_MAX] = {NULL};
int process_index = get_global_cfg_params()->process_idx;
+ for (uint32_t i = 0; i < queue_num; ++i) {
+ t_params[i] = malloc(sizeof(struct thread_params));
+ if (t_params[i] == NULL) {
+ goto OUT;
+ }
+ }
+
for (uint32_t i = 0; i < queue_num; i++) {
if (get_global_cfg_params()->seperate_send_recv) {
if (i % 2 == 0) {
ret = sprintf_s(name, sizeof(name), "%s_%d_%d", LSTACK_RECV_THREAD_NAME, process_index, i / 2);
if (ret < 0) {
- return -1;
+ goto OUT;
}
} else {
ret = sprintf_s(name, sizeof(name), "%s_%d_%d", LSTACK_SEND_THREAD_NAME, process_index, i / 2);
if (ret < 0) {
- return -1;
+ goto OUT;
}
}
} else {
ret = sprintf_s(name, sizeof(name), "%s", LSTACK_THREAD_NAME);
if (ret < 0) {
- return -1;
+ goto OUT;
}
}
- t_params[i] = malloc(sizeof(struct thread_params));
t_params[i]->idx = i;
t_params[i]->queue_id = process_index * queue_num + i;
ret = create_thread((void *)t_params[i], name, gazelle_stack_thread);
if (ret != 0) {
- return ret;
+ goto OUT;
}
}
/* 2: wait stack thread and kernel_event thread init finish */
wait_sem_value(&g_stack_group.sem_stack_setup, queue_num * 2);
if (g_stack_group.stack_setup_fail) {
- return -1;
+ goto OUT;
}
g_stack_group.stack_num = queue_num;
return 0;
+OUT:
+ for (int32_t i = 0; i < queue_num; ++i) {
+ if (t_params[i] != NULL) {
+ free(t_params[i]);
+ }
+ }
+ return -1;
}
void stack_arp(struct rpc_msg *msg)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。