Commit after Gary's comments

This commit is contained in:
AniruddhaKanhere 2020-04-08 12:51:10 -07:00 committed by Yuhui Zheng
parent 666c0da366
commit 75677a8d85

View file

@ -95,6 +95,7 @@ packet to be filled in using a simple memcpy() instead of individual writes. */
* Rule has been relaxed since this is a configuration parameter. And this location provides * Rule has been relaxed since this is a configuration parameter. And this location provides
* more readability. * more readability.
*/ */
/* coverity[misra_c_2012_rule_8_9_violation] */
static const uint8_t xDefaultPartARPPacketHeader[] = static const uint8_t xDefaultPartARPPacketHeader[] =
{ {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Ethernet destination address. */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Ethernet destination address. */
@ -269,7 +270,10 @@ uint8_t ucMinAgeFound = 0U;
xARPCache[x].ucAge = (uint8_t)ipconfigMAX_ARP_AGE; xARPCache[x].ucAge = (uint8_t)ipconfigMAX_ARP_AGE;
xARPCache[x].ucValid = (uint8_t)pdTRUE; xARPCache[x].ucValid = (uint8_t)pdTRUE;
/* MISRA rule 15.5 relaxed for readability of code */ /* MISRA rule 15.5 relaxed for reduced complexity. Not putting
* a return here will increase cyclomatic complexity in later
* part of the code */
/* coverity[misra_c_2012_rule_15_5_violation] */
return; return;
} }
@ -311,9 +315,9 @@ uint8_t ucMinAgeFound = 0U;
ucMinAgeFound = xARPCache[x].ucAge; ucMinAgeFound = xARPCache[x].ucAge;
xUseEntry = x; xUseEntry = x;
} }
else /* Added to supress MISRA rule 15.7 voilation */ else /* Added to suppress MISRA rule 15.7 violation */
{ {
/* Do nothing */ /* Do nothing. */
} }
} }
@ -358,7 +362,9 @@ uint8_t ucMinAgeFound = 0U;
} }
else else
{ {
/* Control should not get here */ /* Do nothing. (pxMACAddress = NULL) and (xIPEntry > 0)
* Implies that an IP address was found but we don't have
* a MAC address for it. Therefore, no action required */
} }
} }
} }
@ -650,10 +656,9 @@ ARPPacket_t *pxARPPacket;
xARPHeader.xTargetHardwareAddress; xARPHeader.xTargetHardwareAddress;
*/ */
/* Casting xDefaultPartARPPacketHeader as ("const" void*). Else it would /* Also, for rule 21.15 regarding using same pointer-to-x types for memcpy,
* be a MISRA c2012 rule 11.18 violation.
* Also, for rule 21.15 regarding using same pointer-to-x types for memcpy,
* below is done intentionally here and thus the rule is relaxed */ * below is done intentionally here and thus the rule is relaxed */
/* coverity[misra_c_2012_rule_21_15_violation] */
memcpy((void*)pxARPPacket, (const void*)xDefaultPartARPPacketHeader, sizeof(xDefaultPartARPPacketHeader)); memcpy((void*)pxARPPacket, (const void*)xDefaultPartARPPacketHeader, sizeof(xDefaultPartARPPacketHeader));
memcpy((void*)pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes, (void*)ipLOCAL_MAC_ADDRESS, (size_t)ipMAC_ADDRESS_LENGTH_BYTES); memcpy((void*)pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes, (void*)ipLOCAL_MAC_ADDRESS, (size_t)ipMAC_ADDRESS_LENGTH_BYTES);
memcpy((void*)pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes, (void*)ipLOCAL_MAC_ADDRESS, (size_t)ipMAC_ADDRESS_LENGTH_BYTES); memcpy((void*)pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes, (void*)ipLOCAL_MAC_ADDRESS, (size_t)ipMAC_ADDRESS_LENGTH_BYTES);
@ -681,6 +686,7 @@ void FreeRTOS_ClearARP( void )
/* MISRA c 2012 rule 8.7 relaxed since this function can be /* MISRA c 2012 rule 8.7 relaxed since this function can be
* called from external location when debugging is enabled */ * called from external location when debugging is enabled */
/* coverity[misra_c_2012_rule_8_7_violation] */
void FreeRTOS_PrintARPCache(void) void FreeRTOS_PrintARPCache(void)
{ {
BaseType_t x, xCount = 0; BaseType_t x, xCount = 0;