Update coverity config; Add coverity version; Update pvPortMalloc declaration to match the definitions.

This commit is contained in:
Aniruddha Kanhere 2024-02-18 20:37:40 +00:00
parent e2bea62815
commit 00412860c4
3 changed files with 54 additions and 60 deletions

View file

@ -2,11 +2,11 @@
FreeRTOS-Kernel conforms to [MISRA C:2012](https://www.misra.org.uk/misra-c) FreeRTOS-Kernel conforms to [MISRA C:2012](https://www.misra.org.uk/misra-c)
guidelines, with the deviations listed below. Compliance is checked with guidelines, with the deviations listed below. Compliance is checked with
Coverity static analysis. Since the FreeRTOS kernel is designed for Coverity static analysis version 2023.6.1. Since the FreeRTOS kernel is
small-embedded devices, it needs to have a very small memory footprint and designed for small-embedded devices, it needs to have a very small memory
has to be efficient. To achieve that and to increase the performance, it footprint and has to be efficient. To achieve that and to increase the
deviates from some MISRA rules. The specific deviations, suppressed inline, performance, it deviates from some MISRA rules. The specific deviations,
are listed below. suppressed inline, are listed below.
Additionally, [MISRA configuration file](examples/coverity/coverity_misra.config) Additionally, [MISRA configuration file](examples/coverity/coverity_misra.config)
contains project wide deviations. contains project wide deviations.

View file

@ -1,97 +1,91 @@
// MISRA C-2012 Rules
{ {
version : "2.0", "version" : "2.0",
standard : "c2012", "standard" : "c2012",
title: "Coverity MISRA Configuration", "title": "Coverity MISRA Configuration",
deviations : [ "deviations" : [
// Disable the following rules.
{ {
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."
}, },
{ {
deviation: "Rule 14.4", "deviation": "Rule 14.4",
reason: "do while( 0 ) pattern is used in macros to prevent extra semi-colon." "reason": "do while( 0 ) pattern is used in macros to prevent extra semi-colon."
},
// Disable the following advisory rules and directives.
{
deviation: "Directive 4.4",
reason: "Code snippet is used in comment to help explanation."
}, },
{ {
deviation: "Directive 4.5", "deviation": "Directive 4.4",
reason: "Allow names that MISRA considers ambiguous." "reason": "Code snippet is used in comment to help explanation."
}, },
{ {
deviation: "Directive 4.6", "deviation": "Directive 4.5",
reason: "Allow port to use primitive type with typedefs." "reason": "Allow names that MISRA considers ambiguous."
}, },
{ {
deviation: "Directive 4.8", "deviation": "Directive 4.6",
reason: "HeapRegion_t and HeapStats_t are used only in heap files but declared in portable.h which is included in multiple source files. As a result, these definitions appear in multiple source files where they are not used." "reason": "Allow port to use primitive type with typedefs."
}, },
{ {
deviation: "Directive 4.9", "deviation": "Directive 4.8",
reason: "FreeRTOS-Kernel is optimised to work on small micro-controllers. To achieve that, function-like macros are used." "reason": "HeapRegion_t and HeapStats_t are used only in heap files but declared in portable.h which is included in multiple source files. As a result, these definitions appear in multiple source files where they are not used."
}, },
{ {
deviation: "Rule 2.3", "deviation": "Directive 4.9",
reason: "FreeRTOS defines types which is used in application." "reason": "FreeRTOS-Kernel is optimised to work on small micro-controllers. To achieve that, function-like macros are used."
}, },
{ {
deviation: "Rule 2.4", "deviation": "Rule 2.3",
reason: "Allow to define unused tag." "reason": "FreeRTOS defines types which is used in application."
}, },
{ {
deviation: "Rule 2.5", "deviation": "Rule 2.4",
reason: "Allow to define unused macro." "reason": "Allow to define unused tag."
}, },
{ {
deviation: "Rule 5.9", "deviation": "Rule 2.5",
reason: "Allow to define identifier with the same name in structure and global variable." "reason": "Allow to define unused macro."
}, },
{ {
deviation: "Rule 8.7", "deviation": "Rule 5.9",
reason: "API functions are not used by the library outside of the files they are defined; however, they must be externally visible in order to be used by an application." "reason": "Allow to define identifier with the same name in structure and global variable."
}, },
{ {
deviation: "Rule 8.9", "deviation": "Rule 8.7",
reason: "Allow to object to be defined in wider scope for debug purpose." "reason": "API functions are not used by the library outside of the files they are defined; however, they must be externally visible in order to be used by an application."
}, },
{ {
deviation: "Rule 8.13", "deviation": "Rule 8.9",
reason: "Allow to not to use const-qualified type for callback function." "reason": "Allow to object to be defined in wider scope for debug purpose."
}, },
{ {
deviation: "Rule 11.4", "deviation": "Rule 8.13",
reason: "Allow to convert between a pointer to object and an interger type for stack alignment." "reason": "Allow to not to use const-qualified type for callback function."
}, },
{ {
deviation: "Rule 15.4", "deviation": "Rule 11.4",
reason: "Allow to use multiple break statements in a loop." "reason": "Allow to convert between a pointer to object and an interger type for stack alignment."
}, },
{ {
deviation: "Rule 15.5", "deviation": "Rule 15.4",
reason: "Allow to use multiple points of exit." "reason": "Allow to use multiple break statements in a loop."
}, },
{ {
deviation: "Rule 17.8", "deviation": "Rule 15.5",
reason: "Allow to update the parameters of a function." "reason": "Allow to use multiple points of exit."
}, },
{ {
deviation: "Rule 18.4", "deviation": "Rule 17.8",
reason: "Allow to use pointer arithmetic." "reason": "Allow to update the parameters of a function."
}, },
{ {
deviation: "Rule 19.2", "deviation": "Rule 18.4",
reason: "Allow to use union." "reason": "Allow to use pointer arithmetic."
}, },
{ {
deviation: "Rule 20.5", "deviation": "Rule 19.2",
reason: "Allow to use #undef for MPU wrappers." "reason": "Allow to use union."
},
{
"deviation": "Rule 20.5",
"reason": "Allow to use #undef for MPU wrappers."
} }
] ]
} }

View file

@ -178,7 +178,7 @@ void vPortGetHeapStats( HeapStats_t * pxHeapStats );
/* /*
* Map to the memory management routines required for the port. * Map to the memory management routines required for the port.
*/ */
void * pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; void * pvPortMalloc( size_t xWantedSize ) PRIVILEGED_FUNCTION;
void * pvPortCalloc( size_t xNum, void * pvPortCalloc( size_t xNum,
size_t xSize ) PRIVILEGED_FUNCTION; size_t xSize ) PRIVILEGED_FUNCTION;
void vPortFree( void * pv ) PRIVILEGED_FUNCTION; void vPortFree( void * pv ) PRIVILEGED_FUNCTION;