From: OpenOCD-Gerrit <ope...@us...> - 2022-11-15 21:35:38
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2e9f04c11a5aeb9c7aa9d387f9f4d0e7c65a1f5b (commit) from 2bad55bf83bcd4a24711a88b06971f3f828947bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2e9f04c11a5aeb9c7aa9d387f9f4d0e7c65a1f5b Author: Giulio Fieramosca <gi...@gl...> Date: Thu Nov 3 20:38:20 2022 +0100 rtos/ThreadX: added check for NULL-named tasks Thread name loading was not correctly handled if a ThreadX task has a NULL name. Signed-off-by: Giulio Fieramosca <gi...@gl...> Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6 Reviewed-on: https://review.openocd.org/c/openocd/+/7328 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c index 5f90eb644..5bdd007d4 100644 --- a/src/rtos/ThreadX.c +++ b/src/rtos/ThreadX.c @@ -370,16 +370,21 @@ static int threadx_update_threads(struct rtos *rtos) } /* Read the thread name */ - retval = - target_read_buffer(rtos->target, - name_ptr, - THREADX_THREAD_NAME_STR_SIZE, - (uint8_t *)&tmp_str); - if (retval != ERROR_OK) { - LOG_ERROR("Error reading thread name from ThreadX target"); - return retval; + tmp_str[0] = '\x00'; + + /* Check if thread has a valid name */ + if (name_ptr != 0) { + retval = + target_read_buffer(rtos->target, + name_ptr, + THREADX_THREAD_NAME_STR_SIZE, + (uint8_t *)&tmp_str); + if (retval != ERROR_OK) { + LOG_ERROR("Error reading thread name from ThreadX target"); + return retval; + } + tmp_str[THREADX_THREAD_NAME_STR_SIZE - 1] = '\x00'; } - tmp_str[THREADX_THREAD_NAME_STR_SIZE-1] = '\x00'; if (tmp_str[0] == '\x00') strcpy(tmp_str, "No Name"); ----------------------------------------------------------------------- Summary of changes: src/rtos/ThreadX.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) hooks/post-receive -- Main OpenOCD repository |