Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ jobs:

proof_ci:
if: ${{ github.event.pull_request }}
runs-on: cbmc_ubuntu-latest_16-core
runs-on: cbmc_ubuntu-latest_64-core
steps:
- name: Set up CBMC runner
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
Expand Down
12 changes: 11 additions & 1 deletion MISRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ _Ref 10.5.1_

- MISRA C-2012 Rule 10.5 Converting from an unsigned to an enum type. The
operation is safe to perform in that case, as we are using a generic API to
send and receive data, in that case the exact data sent it is received
send and receive data, in that case the exact data sent it is received.

#### Rule 10.8

_Ref 10.8.1_

- MISRA C-2012 Rule 10.8 Casting a composite expression from a signed to an
unsigned type. The operation is safe to perform in this case as we have verified
that the pointer being subtracted from is greater than or equal to the pointer
being subtracted thereby making the result positive. This result can be safely
casted to an unsigned type like size_t.

#### Rule 11.1

Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_DNS.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ const MACAddress_t xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB
* @return Always pdFAIL to indicate that the packet was not consumed and must
* be released by the caller.
*/
uint32_t ulDNSHandlePacket( const NetworkBufferDescriptor_t * pxNetworkBuffer )
BaseType_t xDNSHandlePacket( const NetworkBufferDescriptor_t * pxNetworkBuffer )
{
uint8_t * pucPayLoadBuffer;
size_t uxPayloadSize;
Expand Down
5 changes: 4 additions & 1 deletion source/FreeRTOS_DNS_Parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
uint16_t x;
BaseType_t xReturn = pdTRUE;
uint32_t ulIPAddress = 0U;
BaseType_t xDNSHookReturn = 0U;
BaseType_t xDNSHookReturn = 0;
NetworkBufferDescriptor_t * pxNewBuffer = NULL;

( void ) memset( &( xSet ), 0, sizeof( xSet ) );
Expand Down Expand Up @@ -388,6 +388,9 @@
{
/* Note that the Questions section turns into the Answers section.
* uxSkipCount points to the first byte after e.g. 'name.local' */
/* MISRA Ref 10.8.1 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-108 */
/* coverity[misra_c_2012_rule_10_8_violation] */
xSet.uxSkipCount = ( size_t ) ( xSet.pucByte - pucUDPPayloadBuffer );
}

Expand Down
22 changes: 11 additions & 11 deletions source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void prvProcessIPEventsAndTimers( void )
switch( pxSocket->bits.bIsIPv6 ) /* LCOV_EXCL_BR_LINE */
{
#if ( ipconfigUSE_IPv4 != 0 )
case pdFALSE_UNSIGNED:
case ipFALSE_BOOL:
xAddress.sin_family = FREERTOS_AF_INET;
xAddress.sin_address.ulIP_IPv4 = FreeRTOS_htonl( pxSocket->xLocalAddress.ulIP_IPv4 );
/* 'ulLocalAddress' will be set again by vSocketBind(). */
Expand All @@ -352,7 +352,7 @@ static void prvProcessIPEventsAndTimers( void )
#endif /* ( ipconfigUSE_IPv4 != 0 ) */

#if ( ipconfigUSE_IPv6 != 0 )
case pdTRUE_UNSIGNED:
case ipTRUE_BOOL:
xAddress.sin_family = FREERTOS_AF_INET6;
( void ) memcpy( xAddress.sin_address.xIP_IPv6.ucBytes, pxSocket->xLocalAddress.xIP_IPv6.ucBytes, sizeof( xAddress.sin_address.xIP_IPv6.ucBytes ) );
/* 'ulLocalAddress' will be set again by vSocketBind(). */
Expand Down Expand Up @@ -568,10 +568,10 @@ static void prvIPTask_CheckPendingEvents( void )
pxInterface != NULL;
pxInterface = FreeRTOS_NextNetworkInterface( pxInterface ) )
{
if( pxInterface->bits.bCallDownEvent != pdFALSE_UNSIGNED )
if( pxInterface->bits.bCallDownEvent != ipFALSE_BOOL )
{
prvProcessNetworkDownEvent( pxInterface );
pxInterface->bits.bCallDownEvent = pdFALSE_UNSIGNED;
pxInterface->bits.bCallDownEvent = ipFALSE_BOOL;
}
}
}
Expand Down Expand Up @@ -656,7 +656,7 @@ void vIPNetworkUpCalls( struct xNetworkEndPoint * pxEndPoint )
#endif
}

pxEndPoint->bits.bEndPointUp = pdTRUE_UNSIGNED;
pxEndPoint->bits.bEndPointUp = ipTRUE_BOOL;

#if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 )
#if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
Expand Down Expand Up @@ -762,21 +762,21 @@ void FreeRTOS_NetworkDown( struct xNetworkInterface * pxNetworkInterface )
IPStackEvent_t xNetworkDownEvent;
const TickType_t xDontBlock = ( TickType_t ) 0;

pxNetworkInterface->bits.bInterfaceUp = pdFALSE_UNSIGNED;
pxNetworkInterface->bits.bInterfaceUp = ipFALSE_BOOL;
xNetworkDownEvent.eEventType = eNetworkDownEvent;
xNetworkDownEvent.pvData = pxNetworkInterface;

/* Simply send the network task the appropriate event. */
if( xSendEventStructToIPTask( &xNetworkDownEvent, xDontBlock ) != pdPASS )
{
/* Could not send the message, so it is still pending. */
pxNetworkInterface->bits.bCallDownEvent = pdTRUE;
pxNetworkInterface->bits.bCallDownEvent = ipTRUE_BOOL;
xNetworkDownEventPending = pdTRUE;
}
else
{
/* Message was sent so it is not pending. */
pxNetworkInterface->bits.bCallDownEvent = pdFALSE;
pxNetworkInterface->bits.bCallDownEvent = ipFALSE_BOOL;
}

iptraceNETWORK_DOWN();
Expand Down Expand Up @@ -805,13 +805,13 @@ BaseType_t FreeRTOS_NetworkDownFromISR( struct xNetworkInterface * pxNetworkInte
if( xQueueSendToBackFromISR( xNetworkEventQueue, &xNetworkDownEvent, &xHigherPriorityTaskWoken ) != pdPASS )
{
/* Could not send the message, so it is still pending. */
pxNetworkInterface->bits.bCallDownEvent = pdTRUE;
pxNetworkInterface->bits.bCallDownEvent = ipTRUE_BOOL;
xNetworkDownEventPending = pdTRUE;
}
else
{
/* Message was sent so it is not pending. */
pxNetworkInterface->bits.bCallDownEvent = pdFALSE;
pxNetworkInterface->bits.bCallDownEvent = ipFALSE_BOOL;
xNetworkDownEventPending = pdFALSE;
}

Expand Down Expand Up @@ -1773,7 +1773,7 @@ static void prvProcessEthernetPacket( NetworkBufferDescriptor_t * const pxNetwor
break;
} /* switch( pxEthernetHeader->usFrameType ) */
}
} while( pdFALSE );
} while( ipFALSE_BOOL );

/* Perform any actions that resulted from processing the Ethernet frame. */
switch( eReturned )
Expand Down
42 changes: 21 additions & 21 deletions source/FreeRTOS_IP_Timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,14 @@ static void prvIPTimerStart( IPTimer_t * pxTimer,

if( xTime == ( TickType_t ) 0 )
{
pxTimer->bExpired = pdTRUE_UNSIGNED;
pxTimer->bExpired = ipTRUE_BOOL;
}
else
{
pxTimer->bExpired = pdFALSE_UNSIGNED;
pxTimer->bExpired = ipFALSE_BOOL;
}

pxTimer->bActive = pdTRUE_UNSIGNED;
pxTimer->bActive = ipTRUE_BOOL;
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -559,15 +559,15 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
/* The timer might have set the bExpired flag already, if not, check the
* value of xTimeOut against ulRemainingTime. */
if( pxTimer->bExpired == pdFALSE_UNSIGNED )
if( pxTimer->bExpired == ipFALSE_BOOL )
{
if( xTaskCheckForTimeOut( &( pxTimer->xTimeOut ), &( pxTimer->ulRemainingTime ) ) != pdFALSE )
{
pxTimer->bExpired = pdTRUE_UNSIGNED;
pxTimer->bExpired = ipTRUE_BOOL;
}
}

if( pxTimer->bExpired != pdFALSE_UNSIGNED )
if( pxTimer->bExpired != ipFALSE_BOOL )
{
prvIPTimerStart( pxTimer, pxTimer->ulReloadTime );
xReturn = pdTRUE;
Expand All @@ -591,15 +591,15 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
*/
void vIPSetTCPTimerExpiredState( BaseType_t xExpiredState )
{
xTCPTimer.bActive = pdTRUE_UNSIGNED;
xTCPTimer.bActive = ipTRUE_BOOL;

if( xExpiredState != pdFALSE )
{
xTCPTimer.bExpired = pdTRUE_UNSIGNED;
xTCPTimer.bExpired = ipTRUE_BOOL;
}
else
{
xTCPTimer.bExpired = pdFALSE_UNSIGNED;
xTCPTimer.bExpired = ipFALSE_BOOL;
}
}
#endif /* if ( ipconfigUSE_TCP == 1 ) */
Expand All @@ -616,11 +616,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
if( xEnableState != pdFALSE )
{
xARPTimer.bActive = pdTRUE_UNSIGNED;
xARPTimer.bActive = ipTRUE_BOOL;
}
else
{
xARPTimer.bActive = pdFALSE_UNSIGNED;
xARPTimer.bActive = ipFALSE_BOOL;
}
}
/*-----------------------------------------------------------*/
Expand All @@ -634,11 +634,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
if( xEnableState != pdFALSE )
{
xARPResolutionTimer.bActive = pdTRUE_UNSIGNED;
xARPResolutionTimer.bActive = ipTRUE_BOOL;
}
else
{
xARPResolutionTimer.bActive = pdFALSE_UNSIGNED;
xARPResolutionTimer.bActive = ipFALSE_BOOL;
}
}
#endif /* if ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) */
Expand All @@ -655,11 +655,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
if( xEnableState != pdFALSE )
{
xNDTimer.bActive = pdTRUE_UNSIGNED;
xNDTimer.bActive = ipTRUE_BOOL;
}
else
{
xNDTimer.bActive = pdFALSE_UNSIGNED;
xNDTimer.bActive = ipFALSE_BOOL;
}
}
/*-----------------------------------------------------------*/
Expand All @@ -673,11 +673,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
if( xEnableState != pdFALSE )
{
xNDResolutionTimer.bActive = pdTRUE_UNSIGNED;
xNDResolutionTimer.bActive = ipTRUE_BOOL;
}
else
{
xNDResolutionTimer.bActive = pdFALSE_UNSIGNED;
xNDResolutionTimer.bActive = ipFALSE_BOOL;
}
}
#endif /* if ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) */
Expand All @@ -699,11 +699,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
/* 'xDHCP_RATimer' is shared between DHCP (IPv4) and RA/SLAAC (IPv6). */
if( xEnableState != 0 )
{
pxEndPoint->xDHCP_RATimer.bActive = pdTRUE_UNSIGNED;
pxEndPoint->xDHCP_RATimer.bActive = ipTRUE_BOOL;
}
else
{
pxEndPoint->xDHCP_RATimer.bActive = pdFALSE_UNSIGNED;
pxEndPoint->xDHCP_RATimer.bActive = ipFALSE_BOOL;
}
}
#endif /* if ( ipconfigUSE_DHCP == 1 ) || ( ipconfigUSE_RA == 1 ) || ( ipconfigUSE_DHCPv6 == 1 ) */
Expand All @@ -720,11 +720,11 @@ static BaseType_t prvIPTimerCheck( IPTimer_t * pxTimer )
{
if( xEnableState != 0 )
{
xDNSTimer.bActive = pdTRUE_UNSIGNED;
xDNSTimer.bActive = ipTRUE_BOOL;
}
else
{
xDNSTimer.bActive = pdFALSE_UNSIGNED;
xDNSTimer.bActive = ipFALSE_BOOL;
}
}

Expand Down
18 changes: 9 additions & 9 deletions source/FreeRTOS_IP_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )
{
/* The bit 'bEndPointUp' stays low until vIPNetworkUpCalls() is called. */
pxEndPoint->bits.bEndPointUp = pdFALSE_UNSIGNED;
pxEndPoint->bits.bEndPointUp = ipFALSE_BOOL;

if( pxEndPoint->bits.bIPv6 == pdTRUE_UNSIGNED )
if( pxEndPoint->bits.bIPv6 == ipTRUE_BOOL )
{
/* IPv6 end-points have a solicited-node address that needs extra housekeeping. */
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
Expand All @@ -851,7 +851,7 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )

#if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 )
{
if( pxEndPoint->bits.bCallDownHook != pdFALSE_UNSIGNED )
if( pxEndPoint->bits.bCallDownHook != ipFALSE_BOOL )
{
#if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
{
Expand All @@ -866,7 +866,7 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
else
{
/* The next time NetworkEventHook will be called for this end-point. */
pxEndPoint->bits.bCallDownHook = pdTRUE_UNSIGNED;
pxEndPoint->bits.bCallDownHook = ipTRUE_BOOL;
}
}
#endif /* ipconfigUSE_NETWORK_EVENT_HOOK */
Expand All @@ -887,7 +887,7 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
if( END_POINT_USES_DHCP( pxEndPoint ) )
{
#if ( ( ipconfigUSE_DHCPv6 != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
if( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED )
if( pxEndPoint->bits.bIPv6 != ipFALSE_BOOL )
{
vDHCPv6Stop( pxEndPoint );
}
Expand Down Expand Up @@ -915,7 +915,7 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )

if( pxInterface->pfInitialise( pxInterface ) == pdPASS )
{
pxInterface->bits.bInterfaceUp = pdTRUE_UNSIGNED;
pxInterface->bits.bInterfaceUp = ipTRUE_BOOL;
/* Set remaining time to 0 so it will become active immediately. */

/* The network is not up until DHCP has completed.
Expand All @@ -929,7 +929,7 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
if( END_POINT_USES_DHCP( pxEndPoint ) )
{
#if ( ( ipconfigUSE_DHCPv6 != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
if( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED )
if( pxEndPoint->bits.bIPv6 != ipFALSE_BOOL )
{
vDHCPv6Process( pdTRUE, pxEndPoint );
}
Expand All @@ -956,13 +956,13 @@ void prvProcessNetworkDownEvent( struct xNetworkInterface * pxInterface )
switch( pxEndPoint->bits.bIPv6 ) /* LCOV_EXCL_BR_LINE */
{
#if ( ipconfigUSE_IPv4 != 0 )
case pdFALSE_UNSIGNED:
case ipFALSE_BOOL:
( void ) memcpy( &( pxEndPoint->ipv4_settings ), &( pxEndPoint->ipv4_defaults ), sizeof( pxEndPoint->ipv4_settings ) );
break;
#endif /* ( ipconfigUSE_IPv4 != 0 ) */

#if ( ipconfigUSE_IPv6 != 0 )
case pdTRUE_UNSIGNED:
case ipTRUE_BOOL:
( void ) memcpy( &( pxEndPoint->ipv6_settings ), &( pxEndPoint->ipv6_defaults ), sizeof( pxEndPoint->ipv6_settings ) );
break;
#endif /* ( ipconfigUSE_IPv6 != 0 ) */
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_IPv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ BaseType_t xIsIPv4Broadcast( uint32_t ulIPAddress,
{
#if ( ipconfigUSE_IPv6 == ipconfigENABLE )
/* Skip over any IPv6 endpoints. */
if( pxEndPoint->bits.bIPv6 == pdTRUE )
if( pxEndPoint->bits.bIPv6 == ipTRUE_BOOL )
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_IPv6_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void vManageSolicitedNodeAddress( const struct xNetworkEndPoint * pxEndPoint,
pxEndPoint->pxNetworkInterface->pfRemoveAllowedMAC( pxEndPoint->pxNetworkInterface, xMACAddress.ucBytes );
}
}
} while( pdFALSE );
} while( ipFALSE_BOOL );
}
/*-----------------------------------------------------------*/

Expand Down
Loading