mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Fix MISRA violations for Kernel release V11.2.0
This commit is contained in:
parent
df0aa5a815
commit
f0f8e9e743
4
MISRA.md
4
MISRA.md
|
@ -120,8 +120,8 @@ _Ref 11.5.5_
|
||||||
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
|
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
|
||||||
|
|
||||||
_Ref 14.3_
|
_Ref 14.3_
|
||||||
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` are
|
- The `configMAX_TASK_NAME_LEN` , `taskRESERVED_TASK_NAME_LENGTH` and `SIZE_MAX`
|
||||||
evaluated to constants at compile time and may vary based on the build
|
are evaluated to constants at compile time and may vary based on the build
|
||||||
configuration.
|
configuration.
|
||||||
|
|
||||||
#### Rule 18.1
|
#### Rule 18.1
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
"standard" : "c2012",
|
"standard" : "c2012",
|
||||||
"title": "Coverity MISRA Configuration",
|
"title": "Coverity MISRA Configuration",
|
||||||
"deviations" : [
|
"deviations" : [
|
||||||
|
{
|
||||||
|
"deviation": "Rule 1.2",
|
||||||
|
"reason": "Allow use of __attribute__ for necessary functions placement in specific memory regions."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"deviation": "Rule 3.1",
|
"deviation": "Rule 3.1",
|
||||||
"reason": "We post HTTP links in code comments which contain // inside comments blocks."
|
"reason": "We post HTTP links in code comments which contain // inside comments blocks."
|
||||||
|
|
5
queue.c
5
queue.c
|
@ -513,7 +513,10 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
/* Check for multiplication overflow. */
|
/* Check for multiplication overflow. */
|
||||||
( ( SIZE_MAX / uxQueueLength ) >= uxItemSize ) &&
|
( ( SIZE_MAX / uxQueueLength ) >= uxItemSize ) &&
|
||||||
/* Check for addition overflow. */
|
/* Check for addition overflow. */
|
||||||
( ( SIZE_MAX - sizeof( Queue_t ) ) >= ( size_t ) ( uxQueueLength * uxItemSize ) ) )
|
/* MISRA Ref 14.3.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] */
|
||||||
|
( ( SIZE_MAX - sizeof( Queue_t ) ) >= ( size_t ) ( ( size_t ) uxQueueLength * ( size_t ) uxItemSize ) ) )
|
||||||
{
|
{
|
||||||
/* Allocate enough space to hold the maximum number of items that
|
/* Allocate enough space to hold the maximum number of items that
|
||||||
* can be in the queue at any time. It is valid for uxItemSize to be
|
* can be in the queue at any time. It is valid for uxItemSize to be
|
||||||
|
|
10
tasks.c
10
tasks.c
|
@ -2016,7 +2016,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
pxNewTCB->xTaskRunState = taskTASK_NOT_RUNNING;
|
pxNewTCB->xTaskRunState = taskTASK_NOT_RUNNING;
|
||||||
|
|
||||||
/* Is this an idle task? */
|
/* Is this an idle task? */
|
||||||
if( ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvIdleTask ) || ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvPassiveIdleTask ) )
|
if( ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) ( &prvIdleTask ) ) || ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) ( &prvPassiveIdleTask ) ) )
|
||||||
{
|
{
|
||||||
pxNewTCB->uxTaskAttributes |= taskATTRIBUTE_IS_IDLE;
|
pxNewTCB->uxTaskAttributes |= taskATTRIBUTE_IS_IDLE;
|
||||||
}
|
}
|
||||||
|
@ -3573,7 +3573,7 @@ static BaseType_t prvCreateIdleTasks( void )
|
||||||
{
|
{
|
||||||
#if ( configNUMBER_OF_CORES == 1 )
|
#if ( configNUMBER_OF_CORES == 1 )
|
||||||
{
|
{
|
||||||
pxIdleTaskFunction = prvIdleTask;
|
pxIdleTaskFunction = &prvIdleTask;
|
||||||
}
|
}
|
||||||
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
{
|
{
|
||||||
|
@ -3582,11 +3582,11 @@ static BaseType_t prvCreateIdleTasks( void )
|
||||||
* run when no other task is available to run. */
|
* run when no other task is available to run. */
|
||||||
if( xCoreID == 0 )
|
if( xCoreID == 0 )
|
||||||
{
|
{
|
||||||
pxIdleTaskFunction = prvIdleTask;
|
pxIdleTaskFunction = &prvIdleTask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pxIdleTaskFunction = prvPassiveIdleTask;
|
pxIdleTaskFunction = &prvPassiveIdleTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
@ -3603,7 +3603,7 @@ static BaseType_t prvCreateIdleTasks( void )
|
||||||
* name will contain an incorrect ASCII character. This is
|
* name will contain an incorrect ASCII character. This is
|
||||||
* acceptable as the task name is used mainly for debugging. */
|
* acceptable as the task name is used mainly for debugging. */
|
||||||
cIdleName[ xIdleTaskNameIndex ] = ( char ) ( xCoreID + '0' );
|
cIdleName[ xIdleTaskNameIndex ] = ( char ) ( xCoreID + '0' );
|
||||||
cIdleName[ xIdleTaskNameIndex + 1 ] = '\0';
|
cIdleName[ xIdleTaskNameIndex + 1U ] = '\0';
|
||||||
}
|
}
|
||||||
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
|
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
|
||||||
|
|
||||||
|
|
19
timers.c
19
timers.c
|
@ -257,7 +257,7 @@
|
||||||
configSTACK_DEPTH_TYPE uxTimerTaskStackSize;
|
configSTACK_DEPTH_TYPE uxTimerTaskStackSize;
|
||||||
|
|
||||||
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &uxTimerTaskStackSize );
|
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &uxTimerTaskStackSize );
|
||||||
xTimerTaskHandle = xTaskCreateStaticAffinitySet( prvTimerTask,
|
xTimerTaskHandle = xTaskCreateStaticAffinitySet( &prvTimerTask,
|
||||||
configTIMER_SERVICE_TASK_NAME,
|
configTIMER_SERVICE_TASK_NAME,
|
||||||
uxTimerTaskStackSize,
|
uxTimerTaskStackSize,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
}
|
}
|
||||||
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
||||||
{
|
{
|
||||||
xReturn = xTaskCreateAffinitySet( prvTimerTask,
|
xReturn = xTaskCreateAffinitySet( &prvTimerTask,
|
||||||
configTIMER_SERVICE_TASK_NAME,
|
configTIMER_SERVICE_TASK_NAME,
|
||||||
configTIMER_TASK_STACK_DEPTH,
|
configTIMER_TASK_STACK_DEPTH,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
configSTACK_DEPTH_TYPE uxTimerTaskStackSize;
|
configSTACK_DEPTH_TYPE uxTimerTaskStackSize;
|
||||||
|
|
||||||
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &uxTimerTaskStackSize );
|
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &uxTimerTaskStackSize );
|
||||||
xTimerTaskHandle = xTaskCreateStatic( prvTimerTask,
|
xTimerTaskHandle = xTaskCreateStatic( &prvTimerTask,
|
||||||
configTIMER_SERVICE_TASK_NAME,
|
configTIMER_SERVICE_TASK_NAME,
|
||||||
uxTimerTaskStackSize,
|
uxTimerTaskStackSize,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
}
|
}
|
||||||
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
||||||
{
|
{
|
||||||
xReturn = xTaskCreate( prvTimerTask,
|
xReturn = xTaskCreate( &prvTimerTask,
|
||||||
configTIMER_SERVICE_TASK_NAME,
|
configTIMER_SERVICE_TASK_NAME,
|
||||||
configTIMER_TASK_STACK_DEPTH,
|
configTIMER_TASK_STACK_DEPTH,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -462,7 +462,7 @@
|
||||||
|
|
||||||
/* Send a message to the timer service task to perform a particular action
|
/* Send a message to the timer service task to perform a particular action
|
||||||
* on a particular timer definition. */
|
* on a particular timer definition. */
|
||||||
if( xTimerQueue != NULL )
|
if( ( xTimerQueue != NULL ) && ( xTimer != NULL ) )
|
||||||
{
|
{
|
||||||
/* Send a command to the timer service task to start the xTimer timer. */
|
/* Send a command to the timer service task to start the xTimer timer. */
|
||||||
xMessage.xMessageID = xCommandID;
|
xMessage.xMessageID = xCommandID;
|
||||||
|
@ -513,7 +513,7 @@
|
||||||
|
|
||||||
/* Send a message to the timer service task to perform a particular action
|
/* Send a message to the timer service task to perform a particular action
|
||||||
* on a particular timer definition. */
|
* on a particular timer definition. */
|
||||||
if( xTimerQueue != NULL )
|
if( ( xTimerQueue != NULL ) && ( xTimer != NULL ) )
|
||||||
{
|
{
|
||||||
/* Send a command to the timer service task to start the xTimer timer. */
|
/* Send a command to the timer service task to start the xTimer timer. */
|
||||||
xMessage.xMessageID = xCommandID;
|
xMessage.xMessageID = xCommandID;
|
||||||
|
@ -974,6 +974,8 @@
|
||||||
* software timer. */
|
* software timer. */
|
||||||
pxTimer = xMessage.u.xTimerParameters.pxTimer;
|
pxTimer = xMessage.u.xTimerParameters.pxTimer;
|
||||||
|
|
||||||
|
if( pxTimer != NULL )
|
||||||
|
{
|
||||||
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
||||||
{
|
{
|
||||||
/* The timer is in a list, remove it. */
|
/* The timer is in a list, remove it. */
|
||||||
|
@ -1079,6 +1081,11 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue