|
156 | 156 | #define configIDLE_TASK_NAME "IDLE"
|
157 | 157 | #endif
|
158 | 158 |
|
| 159 | +#if ( configNUMBER_OF_CORES > 1 ) |
| 160 | + /* Reserve space for Core ID and null termination. */ |
| 161 | + #if ( configMAX_TASK_NAME_LEN < 2U ) |
| 162 | + #error Minimum required task name length is 2. Please increase configMAX_TASK_NAME_LEN. |
| 163 | + #endif |
| 164 | + #define taskRESERVED_TASK_NAME_LENGTH 2U |
| 165 | + |
| 166 | +#elif ( configNUMBER_OF_CORES > 9 ) |
| 167 | + #warning Please increase taskRESERVED_TASK_NAME_LENGTH. 1 character is insufficient to store the core ID. |
| 168 | +#else |
| 169 | + /* Reserve space for null termination. */ |
| 170 | + #if ( configMAX_TASK_NAME_LEN < 1U ) |
| 171 | + #error Minimum required task name length is 1. Please increase configMAX_TASK_NAME_LEN. |
| 172 | + #endif |
| 173 | + #define taskRESERVED_TASK_NAME_LENGTH 1U |
| 174 | +#endif /* if ( ( configNUMBER_OF_CORES > 1 ) */ |
| 175 | + |
159 | 176 | #if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 0 )
|
160 | 177 |
|
161 | 178 | /* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 0 then task selection is
|
@@ -3527,21 +3544,26 @@ static BaseType_t prvCreateIdleTasks( void )
|
3527 | 3544 | BaseType_t xCoreID;
|
3528 | 3545 | char cIdleName[ configMAX_TASK_NAME_LEN ] = { 0 };
|
3529 | 3546 | TaskFunction_t pxIdleTaskFunction = NULL;
|
3530 |
| - BaseType_t xIdleTaskNameIndex; |
3531 |
| - BaseType_t xIdleNameLen; |
3532 |
| - BaseType_t xCopyLen; |
3533 |
| - |
3534 |
| - configASSERT( ( configIDLE_TASK_NAME != NULL ) && ( configMAX_TASK_NAME_LEN > 3 ) ); |
3535 |
| - |
3536 |
| - /* The length of the idle task name is limited to the minimum of the length |
3537 |
| - * of configIDLE_TASK_NAME and configMAX_TASK_NAME_LEN - 2, keeping space |
3538 |
| - * for the core ID suffix and the null-terminator. */ |
3539 |
| - xIdleNameLen = strlen( configIDLE_TASK_NAME ); |
3540 |
| - xCopyLen = xIdleNameLen < ( configMAX_TASK_NAME_LEN - 2 ) ? xIdleNameLen : ( configMAX_TASK_NAME_LEN - 2 ); |
| 3547 | + UBaseType_t xIdleTaskNameIndex; |
3541 | 3548 |
|
3542 |
| - for( xIdleTaskNameIndex = ( BaseType_t ) 0; xIdleTaskNameIndex < xCopyLen; xIdleTaskNameIndex++ ) |
| 3549 | + /* MISRA Ref 14.3.1 [Configuration dependent invariant] */ |
| 3550 | + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-143. */ |
| 3551 | + /* coverity[misra_c_2012_rule_14_3_violation] */ |
| 3552 | + for( xIdleTaskNameIndex = 0U; xIdleTaskNameIndex < ( configMAX_TASK_NAME_LEN - taskRESERVED_TASK_NAME_LENGTH ); xIdleTaskNameIndex++ ) |
3543 | 3553 | {
|
| 3554 | + /* MISRA Ref 18.1.1 [Configuration dependent bounds checking] */ |
| 3555 | + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181. */ |
| 3556 | + /* coverity[misra_c_2012_rule_18_1_violation] */ |
3544 | 3557 | cIdleName[ xIdleTaskNameIndex ] = configIDLE_TASK_NAME[ xIdleTaskNameIndex ];
|
| 3558 | + |
| 3559 | + if( cIdleName[ xIdleTaskNameIndex ] == ( char ) 0x00 ) |
| 3560 | + { |
| 3561 | + break; |
| 3562 | + } |
| 3563 | + else |
| 3564 | + { |
| 3565 | + mtCOVERAGE_TEST_MARKER(); |
| 3566 | + } |
3545 | 3567 | }
|
3546 | 3568 |
|
3547 | 3569 | /* Ensure null termination. */
|
|
0 commit comments