diff --git a/MISRA.md b/MISRA.md index a21bd132e..117e9eb48 100644 --- a/MISRA.md +++ b/MISRA.md @@ -120,7 +120,8 @@ _Ref 11.5.5_ MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant. _Ref 14.3_ - - The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` values + - The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` are + evaluated to constants at compile time and may vary based on the build configuration. constant at compile time however can vary depending on build configuration. This condition takes into account the build configuration of the system. @@ -130,7 +131,9 @@ MISRA C-2012 Rule 18.1: A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operand. _Ref 18.1_ - - The array access is limited to in-bounds values as the null termination + - Array access remains within bounds since either the null terminator in + the IDLE task name will break the loop, or the loop will break normally + if the array size is smaller than the IDLE task name length. of the IDLE task name results in breaking from the loop. Alternatively, if the size is smaller than the IDLE task name length, the loop will exit normally. diff --git a/tasks.c b/tasks.c index acb7a9b32..518c9e87f 100644 --- a/tasks.c +++ b/tasks.c @@ -157,7 +157,7 @@ #endif #if ( configNUMBER_OF_CORES > 1 ) - /* Reserve space for Core ID and null termination */ + /* Reserve space for Core ID and null termination. */ #if ( configMAX_TASK_NAME_LEN < 2U ) #error Minimum required task name length is 2. Please increase configMAX_TASK_NAME_LEN. #endif @@ -166,7 +166,7 @@ #elif ( configNUMBER_OF_CORES > 9 ) #warning Please increase taskRESERVED_TASK_NAME_LENGTH. 1 character is insufficient to store the core ID. #else - /* Reserve space for null termination */ + /* Reserve space for null termination. */ #if ( configMAX_TASK_NAME_LEN < 1U ) #error Minimum required task name length is 1. Please increase configMAX_TASK_NAME_LEN. #endif @@ -3547,12 +3547,12 @@ static BaseType_t prvCreateIdleTasks( void ) UBaseType_t xIdleTaskNameIndex; /* MISRA Ref 14.3.1 [Configuration dependent invariant] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-143 */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-143. */ /* coverity[misra_c_2012_rule_14_3_violation] */ for( xIdleTaskNameIndex = 0U; xIdleTaskNameIndex < ( configMAX_TASK_NAME_LEN - taskRESERVED_TASK_NAME_LENGTH ); xIdleTaskNameIndex++ ) { /* MISRA Ref 18.1.1 [Configuration dependent bounds checking] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181 */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181. */ /* coverity[misra_c_2012_rule_18_1_violation] */ cIdleName[ xIdleTaskNameIndex ] = configIDLE_TASK_NAME[ xIdleTaskNameIndex ];