Skip to content

Commit 7b0328c

Browse files
committed
Fix CBMC
1 parent 652a82a commit 7b0328c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

source/portable/BufferManagement/BufferAllocation_1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ BaseType_t xNetworkBuffersInitialise( void )
206206
uxMaxNetworkInterfaceAllocatedSizeBytes = uxNetworkInterfaceAllocateRAMToBuffers( xNetworkBuffers );
207207

208208
/* The allocated buffer should hold atleast ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER bytes */
209-
configASSERT( ( uxMaxNetworkInterfaceAllocatedSizeBytes >= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) )
209+
configASSERT( ( uxMaxNetworkInterfaceAllocatedSizeBytes >= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) );
210210

211211
for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
212212
{

test/cbmc/proofs/ARP/ARP_OutputARPRequest_buffer_alloc1/OutputARPRequest_harness.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@
2525

2626
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
2727
{
28+
/*
29+
In the case of buffer allocation scheme 1 the network buffers are
30+
fixed size and its asserted in xNetworkBuffersInitialise call that the
31+
buffer is at least ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER bytes
32+
33+
Refer:
34+
configASSERT( ( uxMaxNetworkInterfaceAllocatedSizeBytes >= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) );
35+
36+
*/
37+
size_t xAllocSize = 0;
2838
for( int x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
2939
{
3040
NetworkBufferDescriptor_t * current = &pxNetworkBuffers[ x ];
31-
size_t xAllocSize;
32-
#if ( ipconfigETHERNET_MINIMUM_PACKET_BYTES > 0 )
33-
xAllocSize = sizeof( ARPPacket_t ) + ( ipconfigETHERNET_MINIMUM_PACKET_BYTES - sizeof( ARPPacket_t ) );
34-
current->pucEthernetBuffer = malloc( xAllocSize );
35-
#else
36-
xAllocSize = sizeof( ARPPacket_t )
37-
current->pucEthernetBuffer = malloc( xAllocSize );
38-
#endif
41+
xAllocSize = ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER;
42+
current->pucEthernetBuffer = malloc( xAllocSize );
3943
__CPROVER_assume( current->pucEthernetBuffer != NULL );
4044
current->xDataLength = sizeof( ARPPacket_t );
4145
}

0 commit comments

Comments
 (0)