Add MISRA suppressions for coverity

This commit is contained in:
Kody Stribrny 2025-01-24 09:24:18 -08:00
parent b52f825aea
commit 795941bacb
2 changed files with 25 additions and 3 deletions

View file

@ -115,6 +115,25 @@ _Ref 11.5.5_
because data storage buffers are implemented as uint8_t arrays for the
ease of sizing, alignment and access.
#### Rule 14.3
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
_Ref 14.3.1_
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` values
constant at compile time however can vary depending on build configuration.
This condition takes into account the build configuration of the system.
#### Rule 18.1
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
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.
#### Rule 21.6
MISRA C-2012 Rule 21.6: The Standard Library input/output functions shall not

View file

@ -3546,13 +3546,16 @@ static BaseType_t prvCreateIdleTasks( void )
TaskFunction_t pxIdleTaskFunction = NULL;
UBaseType_t xIdleTaskNameIndex;
/* MISRA Ref 18.1 [Configuration dependent invariant] */
/* 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++ )
{
cIdleName[ xIdleTaskNameIndex ] = configIDLE_TASK_NAME[ xIdleTaskNameIndex ];
/* Don't copy all configMAX_TASK_NAME_LEN if the string is shorter than
* configMAX_TASK_NAME_LEN characters just in case the memory after the
* string is not accessible (extremely unlikely). */
/* MISRA Ref 18.1.1 [Configuration dependent bounds checking] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181 */
/* coverity[misra_c_2012_rule_18_1_violation] */
if( cIdleName[ xIdleTaskNameIndex ] == ( char ) 0x00 )
{
break;