This is an automated email from Gerrit.

Jonathan Dumaresq ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/3400

-- gerrit

commit 7c0d684187af4d8a8371fde6017f237bbc944451
Author: Jonathan Dumaresq <[email protected]>
Date:   Fri Apr 8 10:38:00 2016 -0400

    RTOS support: Correction of out of bound access of thread array
    
    FreeRTOS use an array to store ready task. The array size is
    configMAX_PRIORITIES. In the current implementation, the code try to access 
1 more priority.
    This has effect of detecting bad thread. This patch correct this and have 
been tested on
    a code with more than 12 task.
    
    Change-Id: Id229f0b2c4bf1aab87a2a69be174cc9b6dda00cb
    Signed-off-by: Jonathan Dumaresq <[email protected]>

diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index 9313773..95d2136 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -265,14 +265,14 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
 
        symbol_address_t *list_of_lists =
                malloc(sizeof(symbol_address_t) *
-                       (max_used_priority+1 + 5));
+                       (max_used_priority + 5));
        if (!list_of_lists) {
                LOG_ERROR("Error allocating memory for %" PRId64 " priorities", 
max_used_priority);
                return ERROR_FAIL;
        }
 
        int num_lists;
-       for (num_lists = 0; num_lists <= max_used_priority; num_lists++)
+       for (num_lists = 0; num_lists < max_used_priority; num_lists++)
                list_of_lists[num_lists] = 
rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address +
                        num_lists * param->list_width;
 

-- 

------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to