diff --git a/MISRA.md b/MISRA.md index 79f78d0a8..26f8dd3cf 100644 --- a/MISRA.md +++ b/MISRA.md @@ -199,6 +199,9 @@ _Ref 14.3.1_ - MISRA C-2012 Rule 14.3 False positive as the value might be changed depending on the conditionally compiled code +- MISRA C-2012 Rule 14.3 The controlling expression compares sizeof against a + configuration constant. The result is invariant for a given configuration but + varies across different user configurations. #### Rule 17.2 diff --git a/source/FreeRTOS_ARP.c b/source/FreeRTOS_ARP.c index a9dedb820..d61f3fb3a 100644 --- a/source/FreeRTOS_ARP.c +++ b/source/FreeRTOS_ARP.c @@ -1194,6 +1194,9 @@ { /* This is called from the context of the IP event task, so a block time * must not be used. */ + /* MISRA Ref 14.3.1 [Invariant controlling expression] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-143 */ + /* coverity[misra_c_2012_rule_14_3_violation] */ pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( ( ( sizeof( ARPPacket_t ) > ( size_t ) ipconfigETHERNET_MINIMUM_PACKET_BYTES ) ? sizeof( ARPPacket_t ) : ( size_t ) ipconfigETHERNET_MINIMUM_PACKET_BYTES ), ( TickType_t ) 0U ); if( pxNetworkBuffer != NULL )