1
0
mirror of https://github.com/FreeRTOS/FreeRTOS-Plus-TCP synced 2025-10-21 23:30:39 +08:00

Fix MISRA violations (#1159)

This commit is contained in:
Tony Josi
2024-06-18 12:24:23 +05:30
committed by GitHub
parent 4c4223a16a
commit 0c232efb4a
6 changed files with 11 additions and 4 deletions

View File

@@ -330,6 +330,7 @@
#if ( ipconfigUSE_DNS_CACHE == 1 ) || ( ipconfigDNS_USE_CALLBACKS == 1 ) #if ( ipconfigUSE_DNS_CACHE == 1 ) || ( ipconfigDNS_USE_CALLBACKS == 1 )
uxResult = DNS_ReadNameField( &xSet, uxResult = DNS_ReadNameField( &xSet,
sizeof( xSet.pcName ) ); sizeof( xSet.pcName ) );
( void ) uxResult;
#endif #endif
} }
} }
@@ -359,6 +360,7 @@
{ {
uxResult = DNS_ReadNameField( &xSet, uxResult = DNS_ReadNameField( &xSet,
sizeof( xSet.pcName ) ); sizeof( xSet.pcName ) );
( void ) uxResult;
} }
else else
#endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS */ #endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS */

View File

@@ -489,7 +489,7 @@
if( pxEndPoint->xRAData.bits.bRouterReplied != pdFALSE_UNSIGNED ) if( pxEndPoint->xRAData.bits.bRouterReplied != pdFALSE_UNSIGNED )
{ {
/* Obtained configuration from a router. */ /* Obtained configuration from a router. */
uxNewReloadTime = pdMS_TO_TICKS( 1000U * pxEndPoint->xRAData.ulPreferredLifeTime ); uxNewReloadTime = pdMS_TO_TICKS( ( 1000U * ( uint64_t ) pxEndPoint->xRAData.ulPreferredLifeTime ) );
pxEndPoint->xRAData.eRAState = eRAStatePreLease; pxEndPoint->xRAData.eRAState = eRAStatePreLease;
iptraceRA_SUCCEEDED( &( pxEndPoint->ipv6_settings.xIPAddress ) ); iptraceRA_SUCCEEDED( &( pxEndPoint->ipv6_settings.xIPAddress ) );
FreeRTOS_printf( ( "RA: succeeded, using IP address %pip Reload after %u seconds\n", FreeRTOS_printf( ( "RA: succeeded, using IP address %pip Reload after %u seconds\n",

View File

@@ -2893,6 +2893,8 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket,
/* The type cast of the pointer expression "A" to /* The type cast of the pointer expression "A" to
* type "B" removes const qualifier from the pointed to type. */ * type "B" removes const qualifier from the pointed to type. */
ipconfigISO_STRICTNESS_VIOLATION_START;
/* MISRA Ref 11.8.1 [Function pointer and use of const pointer] */ /* MISRA Ref 11.8.1 [Function pointer and use of const pointer] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-118 */ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-118 */
@@ -2901,7 +2903,6 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket,
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-111 */ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-111 */
/* coverity[misra_c_2012_rule_11_8_violation] */ /* coverity[misra_c_2012_rule_11_8_violation] */
/* coverity[misra_c_2012_rule_11_1_violation] */ /* coverity[misra_c_2012_rule_11_1_violation] */
ipconfigISO_STRICTNESS_VIOLATION_START;
pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue; pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue;
ipconfigISO_STRICTNESS_VIOLATION_END; ipconfigISO_STRICTNESS_VIOLATION_END;
xReturn = 0; xReturn = 0;

View File

@@ -277,6 +277,10 @@
static BaseType_t vTCPRemoveTCPChild( const FreeRTOS_Socket_t * pxChildSocket ) static BaseType_t vTCPRemoveTCPChild( const FreeRTOS_Socket_t * pxChildSocket )
{ {
BaseType_t xReturn = pdFALSE; BaseType_t xReturn = pdFALSE;
/* MISRA Ref 11.3.1 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
const ListItem_t * pxEnd = ( ( const ListItem_t * ) &( xBoundTCPSocketsList.xListEnd ) ); const ListItem_t * pxEnd = ( ( const ListItem_t * ) &( xBoundTCPSocketsList.xListEnd ) );
/* MISRA Ref 11.3.1 [Misaligned access] */ /* MISRA Ref 11.3.1 [Misaligned access] */

View File

@@ -200,7 +200,7 @@ FreeRTOS_Socket_t * prvHandleListen_IPV4( FreeRTOS_Socket_t * pxSocket,
/* Close the socket if it was newly created. */ /* Close the socket if it was newly created. */
if( xIsNewSocket == pdTRUE ) if( xIsNewSocket == pdTRUE )
{ {
vSocketClose( pxReturn ); ( void ) vSocketClose( pxReturn );
} }
pxReturn = NULL; pxReturn = NULL;

View File

@@ -200,7 +200,7 @@ FreeRTOS_Socket_t * prvHandleListen_IPV6( FreeRTOS_Socket_t * pxSocket,
/* Close the socket if it was newly created. */ /* Close the socket if it was newly created. */
if( xIsNewSocket == pdTRUE ) if( xIsNewSocket == pdTRUE )
{ {
vSocketClose( pxReturn ); ( void ) vSocketClose( pxReturn );
} }
pxReturn = NULL; pxReturn = NULL;