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
1 change: 1 addition & 0 deletions .github/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ callbacklist
calloc
cambridge
camen
caretline
carriersense
castingmacrofunctions
cbmc
Expand Down
10 changes: 7 additions & 3 deletions source/FreeRTOS_DNS_Cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@
{ /* Element found */
if( xLookUp == pdTRUE )
{
prvGetCacheIPEntry( uxIndex,
pulIP,
ulCurrentTimeSeconds );
/* This statement can only be reached when xResult is true; which
* implies that the entry is present and a 'get' operation will result
* in success. Therefore, it is safe to ignore the return value of the
* below function. */
( void ) prvGetCacheIPEntry( uxIndex,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a comment about why the result is being discarded here and why is it safe to do so.
Something along the lines of:

/* This statement can only be reached when xResult is true; which
 * implies that the entry is present and a 'get' operation will result
 * in success. Therefore, it is safe to ignore the return value of the
 * below function. */

Copy link
Member Author

@xuelix xuelix Aug 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have too many (void) in front of functions (e.g. hundreds of them including memcpy) . I don't think we need to add for one specific function calls.

pulIP,
ulCurrentTimeSeconds );
}
else
{
Expand Down
32 changes: 19 additions & 13 deletions source/FreeRTOS_IP_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static NetworkBufferDescriptor_t * prvPacketBuffer_to_NetworkBuffer( const void
xEventMessage.eEventType = eDHCPEvent;

/* MISRA Ref 11.6.1 [DHCP events and conversion to void] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-116 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-116 */
/* coverity[misra_c_2012_rule_11_6_violation] */
xEventMessage.pvData = ( void * ) uxOption;

Expand Down Expand Up @@ -231,7 +231,7 @@ static NetworkBufferDescriptor_t * prvPacketBuffer_to_NetworkBuffer( const void
/* Obtain the network buffer from the zero copy pointer. */

/* MISRA Ref 11.6.2 [Pointer arithmetic and hidden pointer] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-116 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-116 */
/* coverity[misra_c_2012_rule_11_6_violation] */
uxBuffer = ( uintptr_t ) pvBuffer;

Expand All @@ -245,7 +245,7 @@ static NetworkBufferDescriptor_t * prvPacketBuffer_to_NetworkBuffer( const void
if( ( uxBuffer & ( ( ( uintptr_t ) sizeof( uxBuffer ) ) - 1U ) ) == ( uintptr_t ) 0U )
{
/* MISRA Ref 11.4.2 [Validation of pointer alignment] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* coverity[misra_c_2012_rule_11_4_violation] */
pxResult = *( ( NetworkBufferDescriptor_t ** ) uxBuffer );
}
Expand Down Expand Up @@ -321,6 +321,10 @@ BaseType_t xIsCallingFromIPTask( void )
/**
* @brief Process a 'Network down' event and complete required processing.
*/
/* MISRA Ref 8.9.1 [File scoped variables] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-89 */
/* coverity[misra_c_2012_rule_8_9_violation] */
/* coverity[single_use] */
void prvProcessNetworkDownEvent( void )
{
/* Stop the ARP timer while there is no network. */
Expand Down Expand Up @@ -473,7 +477,7 @@ uint16_t usGenerateProtocolChecksum( uint8_t * pucEthernetBuffer,
/* Parse the packet length. */

/* MISRA Ref 11.3.1 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
pxIPPacket = ( ( const IPPacket_t * ) pucEthernetBuffer );

Expand Down Expand Up @@ -518,7 +522,7 @@ uint16_t usGenerateProtocolChecksum( uint8_t * pucEthernetBuffer,
* of this calculation. */

/* MISRA Ref 11.3.1 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
pxProtPack = ( ( ProtocolPacket_t * ) &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );

Expand Down Expand Up @@ -848,7 +852,7 @@ uint16_t usGenerateChecksum( uint16_t usSum,
xSource.u8ptr = pucNextData;

/* MISRA Ref 11.4.3 [Casting pointer to int for verification] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* coverity[misra_c_2012_rule_11_4_violation] */
uxAlignBits = ( ( ( uintptr_t ) pucNextData ) & 0x03U );

Expand Down Expand Up @@ -956,21 +960,23 @@ uint16_t usGenerateChecksum( uint16_t usSum,
}

/* MISRA Ref 2.2.1 [Unions and dead code] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* coverity[misra_c_2012_rule_2_2_violation] */
/* coverity[assigned_value] */
xSum.u32 += xTerm.u32;

/* Now add all carries again. */

/* Assigning value from "xTerm.u32" to "xSum.u32" here, but that stored value is overwritten before it can be used.
* /* MISRA Ref 2.2.1 [Unions and dead code] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* Assigning value from "xTerm.u32" to "xSum.u32" here, but that stored value is overwritten before it can be used. */
/* MISRA Ref 2.2.1 [Unions and dead code] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* coverity[misra_c_2012_rule_2_2_violation] */
/* coverity[value_overwrite] */
xSum.u32 = ( uint32_t ) xSum.u16[ 0 ] + xSum.u16[ 1 ];

/* coverity[value_overwrite] */
/* MISRA Ref 2.2.1 [Unions and dead code] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-22 */
/* coverity[misra_c_2012_rule_2_2_violation] */
xSum.u32 = ( uint32_t ) xSum.u16[ 0 ] + xSum.u16[ 1 ];

Expand Down Expand Up @@ -1149,7 +1155,7 @@ const char * FreeRTOS_strerror_r( BaseType_t xErrnum,

default:
/* MISRA Ref 21.6.1 [snprintf and logging] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */
/* coverity[misra_c_2012_rule_21_6_violation] */
( void ) snprintf( pcBuffer, uxLength, "Errno %d", xErrnum );
pcName = NULL;
Expand All @@ -1159,7 +1165,7 @@ const char * FreeRTOS_strerror_r( BaseType_t xErrnum,
if( pcName != NULL )
{
/* MISRA Ref 21.6.1 [snprintf and logging] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */
/* coverity[misra_c_2012_rule_21_6_violation] */
( void ) snprintf( pcBuffer, uxLength, "%s", pcName );
}
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_Stream_Buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ size_t uxStreamBufferAdd( StreamBuffer_t * pxBuffer,
pxBuffer->uxFront = uxNextHead;
}
}
xTaskResumeAll();
( void ) xTaskResumeAll();
}

return uxCount;
Expand Down
3 changes: 2 additions & 1 deletion test/Coverity/ConfigFiles/pack_struct_end.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
* placement in memory. */

/* The language extension is used in a portable manner for each specific compiler */
/* coverity[misra_c_2012_rule_1_2_violation]*/
/* coverity[misra_c_2012_rule_1_2_violation] */
/* coverity[caretline] */
__attribute__( ( packed ) );