Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MISRA 2012 violations #1159

Merged
merged 1 commit into from
Jun 18, 2024
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: 2 additions & 0 deletions source/FreeRTOS_DNS_Parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
#if ( ipconfigUSE_DNS_CACHE == 1 ) || ( ipconfigDNS_USE_CALLBACKS == 1 )
uxResult = DNS_ReadNameField( &xSet,
sizeof( xSet.pcName ) );
( void ) uxResult;
#endif
}
}
Expand Down Expand Up @@ -359,6 +360,7 @@
{
uxResult = DNS_ReadNameField( &xSet,
sizeof( xSet.pcName ) );
( void ) uxResult;
}
else
#endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS */
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_RA.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
if( pxEndPoint->xRAData.bits.bRouterReplied != pdFALSE_UNSIGNED )
{
/* 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;
iptraceRA_SUCCEEDED( &( pxEndPoint->ipv6_settings.xIPAddress ) );
FreeRTOS_printf( ( "RA: succeeded, using IP address %pip Reload after %u seconds\n",
Expand Down
3 changes: 2 additions & 1 deletion source/FreeRTOS_Sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -2893,6 +2893,8 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket,
/* The type cast of the pointer expression "A" to
* 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] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-118 */

Expand All @@ -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 */
/* coverity[misra_c_2012_rule_11_8_violation] */
/* coverity[misra_c_2012_rule_11_1_violation] */
ipconfigISO_STRICTNESS_VIOLATION_START;
pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue;
ipconfigISO_STRICTNESS_VIOLATION_END;
xReturn = 0;
Expand Down
4 changes: 4 additions & 0 deletions source/FreeRTOS_TCP_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@
static BaseType_t vTCPRemoveTCPChild( const FreeRTOS_Socket_t * pxChildSocket )
{
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 ) );

/* MISRA Ref 11.3.1 [Misaligned access] */
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_TCP_State_Handling_IPv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ FreeRTOS_Socket_t * prvHandleListen_IPV4( FreeRTOS_Socket_t * pxSocket,
/* Close the socket if it was newly created. */
if( xIsNewSocket == pdTRUE )
{
vSocketClose( pxReturn );
( void ) vSocketClose( pxReturn );
}

pxReturn = NULL;
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_TCP_State_Handling_IPv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ FreeRTOS_Socket_t * prvHandleListen_IPV6( FreeRTOS_Socket_t * pxSocket,
/* Close the socket if it was newly created. */
if( xIsNewSocket == pdTRUE )
{
vSocketClose( pxReturn );
( void ) vSocketClose( pxReturn );
}

pxReturn = NULL;
Expand Down
Loading