From: openocd-gerrit <ope...@us...> - 2024-12-22 09:52:51
|
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 cd9e64a25ac167d188859e991201d3fe492a91e1 (commit) via dca76cd5dad974996e7231ba0ede544c626ba43d (commit) from 42f70a3b95ea708d0e4fd5d83a6bc6965fd65ac6 (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 cd9e64a25ac167d188859e991201d3fe492a91e1 Author: Antonio Borneo <bor...@gm...> Date: Wed Nov 27 09:25:01 2024 +0100 rtos: mqx: minor rework to avoid a cast Change the type of task_name[] to char in order to drop a cast. Change-Id: I233fc862e972e52130fd4ffcb29a3da36f4f8923 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/8599 Reviewed-by: Paul Fertser <fer...@gm...> Tested-by: jenkins diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c index 90154db3f..017fd2b01 100644 --- a/src/rtos/mqx.c +++ b/src/rtos/mqx.c @@ -319,7 +319,7 @@ static int mqx_update_threads( i < (uint32_t)rtos->thread_count; i++ ) { - uint8_t task_name[MQX_THREAD_NAME_LENGTH + 1]; + char task_name[MQX_THREAD_NAME_LENGTH + 1]; uint32_t task_addr = 0, task_template = 0, task_state = 0; uint32_t task_name_addr = 0, task_id = 0, task_errno = 0; uint32_t state_index = 0; @@ -380,7 +380,7 @@ static int mqx_update_threads( rtos->thread_details[i].threadid = task_id; rtos->thread_details[i].exists = true; /* set thread name */ - rtos->thread_details[i].thread_name_str = strdup((char *)task_name); + rtos->thread_details[i].thread_name_str = strdup(task_name); if (!rtos->thread_details[i].thread_name_str) return ERROR_FAIL; /* set thread extra info commit dca76cd5dad974996e7231ba0ede544c626ba43d Author: Paul Fertser <fer...@gm...> Date: Tue Nov 26 22:55:55 2024 +0200 rtos: mqx: replace malloc+strcpy with strdup Using strcpy is potentially dangerous so just use a safer and easier way to do the same. Signed-off-by: Paul Fertser <fer...@gm...> Change-Id: Id85f3b7f8af1eaf14c9951ae710546d2437c70b5 Reviewed-on: https://review.openocd.org/c/openocd/+/8597 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c index b4a182135..90154db3f 100644 --- a/src/rtos/mqx.c +++ b/src/rtos/mqx.c @@ -380,10 +380,9 @@ static int mqx_update_threads( rtos->thread_details[i].threadid = task_id; rtos->thread_details[i].exists = true; /* set thread name */ - rtos->thread_details[i].thread_name_str = malloc(strlen((void *)task_name) + 1); + rtos->thread_details[i].thread_name_str = strdup((char *)task_name); if (!rtos->thread_details[i].thread_name_str) return ERROR_FAIL; - strcpy(rtos->thread_details[i].thread_name_str, (void *)task_name); /* set thread extra info * - task state * - task address ----------------------------------------------------------------------- Summary of changes: src/rtos/mqx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |