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
12 changes: 6 additions & 6 deletions source/FreeRTOS_IP_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1717,11 +1717,11 @@ int32_t FreeRTOS_add_int32( int32_t a,
{
int32_t ret;

if( ( a > 0 ) && ( b > ipINT32_MAX_VALUE - a ) )
if( ( a > 0 ) && ( b > ( ipINT32_MAX_VALUE - a ) ) )
{
ret = ipINT32_MAX_VALUE; /* Positive overflow */
}
else if( ( a < 0 ) && ( b < ipINT32_MIN_VALUE - a ) )
else if( ( a < 0 ) && ( b < ( ipINT32_MIN_VALUE - a ) ) )
{
ret = ipINT32_MIN_VALUE; /* Negative underflow */
}
Expand All @@ -1748,11 +1748,11 @@ int32_t FreeRTOS_multiply_int32( int32_t a,
/* Check for overflow/underflow */
if( a > 0 )
{
if( ( b > 0 ) && ( a > ipINT32_MAX_VALUE / b ) )
if( ( b > 0 ) && ( a > ( ipINT32_MAX_VALUE / b ) ) )
{
ret = ipINT32_MAX_VALUE; /* Positive overflow */
}
else if( ( b < 0 ) && ( b < ipINT32_MIN_VALUE / a ) )
else if( ( b < 0 ) && ( b < ( ipINT32_MIN_VALUE / a ) ) )
{
ret = ipINT32_MIN_VALUE; /* Negative underflow */
}
Expand All @@ -1763,11 +1763,11 @@ int32_t FreeRTOS_multiply_int32( int32_t a,
}
else
{
if( ( b > 0 ) && ( a < ipINT32_MIN_VALUE / b ) )
if( ( b > 0 ) && ( a < ( ipINT32_MIN_VALUE / b ) ) )
{
ret = ipINT32_MIN_VALUE; /* Negative underflow */
}
else if( ( b < 0 ) && ( a < ipINT32_MAX_VALUE / b ) )
else if( ( b < 0 ) && ( a < ( ipINT32_MAX_VALUE / b ) ) )
{
ret = ipINT32_MAX_VALUE; /* Positive overflow */
}
Expand Down
3 changes: 3 additions & 0 deletions source/FreeRTOS_ND.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@

/** @brief The time at which the last unsolicited ND was sent. Unsolicited NDs are used
* to ensure ND tables are up to date and to detect IP address conflicts. */
/* 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] */
static TickType_t xLastUnsolicitedNDTime = 0U;

/*-----------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_TCP_WIN.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@
int32_t lWeight = 0;
int32_t lDivisor = 0;

mS = mS < 0 ? ipINT32_MAX_VALUE : mS;
mS = ( mS < 0 ) ? ipINT32_MAX_VALUE : mS;

if( pxWindow->lSRTT >= mS )
{
Expand Down
4 changes: 2 additions & 2 deletions source/include/FreeRTOS_IP.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
#define ipSIZE_OF_TCP_HEADER 20U

/* The maximum of int32 value. */
#define ipINT32_MAX_VALUE ( ( int32_t ) 0x7FFFFFFF )
#define ipINT32_MAX_VALUE ( ( int32_t ) 0x7FFFFFFFU )

/* The minimum of int32 value. */
#define ipINT32_MIN_VALUE ( ( int32_t ) 0x80000000 )
#define ipINT32_MIN_VALUE ( ( int32_t ) 0x80000000U )

/*
* Generate a randomized TCP Initial Sequence Number per RFC.
Expand Down