Skip to content

Commit 0716c1a

Browse files
committed
Suppress MISRA 14.3 finding in ARP buffer allocation
Move the buffer size ternary into a named macro (arpOUTPUT_REQUEST_BUFFER_SIZE) with a coverity suppression comment. The expression compares sizeof against a configuration constant and is invariant for a given build but varies across user configurations.
1 parent da707f2 commit 0716c1a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

MISRA.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ _Ref 14.3.1_
199199

200200
- MISRA C-2012 Rule 14.3 False positive as the value might be changed depending
201201
on the conditionally compiled code
202+
- MISRA C-2012 Rule 14.3 The controlling expression compares sizeof against a
203+
configuration constant. The result is invariant for a given configuration but
204+
varies across different user configurations.
202205

203206
#### Rule 17.2
204207

source/FreeRTOS_ARP.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,9 @@
11941194
{
11951195
/* This is called from the context of the IP event task, so a block time
11961196
* must not be used. */
1197+
/* MISRA Ref 14.3.1 [Invariant controlling expression] */
1198+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-143 */
1199+
/* coverity[misra_c_2012_rule_14_3_violation] */
11971200
pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( ( ( sizeof( ARPPacket_t ) > ( size_t ) ipconfigETHERNET_MINIMUM_PACKET_BYTES ) ? sizeof( ARPPacket_t ) : ( size_t ) ipconfigETHERNET_MINIMUM_PACKET_BYTES ), ( TickType_t ) 0U );
11981201

11991202
if( pxNetworkBuffer != NULL )

0 commit comments

Comments
 (0)