Skip to content

Commit 062135f

Browse files
committed
Fix CBMC proofs
1 parent 31766df commit 062135f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

test/cbmc/proofs/ARP/ARPGetCacheEntry/Configurations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"--unwindset prvCacheLookup.0:7",
77
"--unwindset FreeRTOS_FindEndPointOnIP_IPv4.0:3",
88
"--unwindset FreeRTOS_InterfaceEndPointOnNetMask.0:3",
9+
"--unwindset xIsIPv4Broadcast.0:3",
910
"--unwindset eARPGetCacheEntry.0:3",
1011
"--unwindset FreeRTOS_FindGateWay.0:3",
1112
"--nondet-static"

test/cbmc/proofs/parsing/ProcessIPPacket/ProcessIPPacket_harness.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ void harness()
157157
NetworkBufferDescriptor_t * const pxNetworkBuffer = safeMalloc( sizeof( NetworkBufferDescriptor_t ) );
158158
uint8_t * pucEthernetBuffer = ( uint8_t * ) safeMalloc( ipTOTAL_ETHERNET_FRAME_SIZE + ipIP_TYPE_OFFSET );
159159
EthernetHeader_t * pxHeader;
160-
160+
NetworkEndPoint_t xEndPoint;
161+
161162
__CPROVER_assume( pxNetworkBuffer != NULL );
162163
__CPROVER_assume( pucEthernetBuffer != NULL );
163164

@@ -166,6 +167,19 @@ void harness()
166167
pxNetworkBuffer->pucEthernetBuffer = &( pucEthernetBuffer[ ipIP_TYPE_OFFSET ] );
167168
__CPROVER_assume( pxNetworkBuffer->pucEthernetBuffer != NULL );
168169

170+
/* prvProcessIPPacket is guranteed to receive a network buffer that has a valid
171+
endpoint, hence no NULL checks are needed to be performed inside prvProcessIPPacket.
172+
See the check:
173+
174+
if( ( pxNetworkBuffer->pxInterface == NULL ) || ( pxNetworkBuffer->pxEndPoint == NULL ) )
175+
{
176+
break;
177+
}
178+
179+
inside the prvProcessEthernetPacket before which prvProcessIPPacket is called.
180+
*/
181+
pxNetworkBuffer->pxEndPoint = &xEndPoint;
182+
169183
/* Minimum length of the pxNetworkBuffer->xDataLength is at least the size of the IPPacket_t. */
170184
__CPROVER_assume( pxNetworkBuffer->xDataLength >= sizeof( IPPacket_t ) && pxNetworkBuffer->xDataLength <= ipTOTAL_ETHERNET_FRAME_SIZE );
171185

0 commit comments

Comments
 (0)