You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
buildPTPMessage()
.../common/ptp_message.cpp
PTPMessageCommon *buildPTPMessage
( char *buf, int size, LinkLayerAddress *remote,
CommonPort *port )
{
...
annc->
grandmasterClockQuality->offsetScaledLogVariance =
Coercion Alters Value help
PLAT_ntohs(...) is coerced from unsigned short to short.
PLAT_ntohs
( annc->grandmasterClockQuality->
offsetScaledLogVariance );
PLAT_ntohs()
.../linux/src/platform.cpp
uint16_t PLAT_ntohs( uint16_t s ) {
return ntohs( s );
}
SCA complains here about ntohs() but I believe the real issue is the type of offsetScaledLogVariance in struct ClockQuality, which currently in the code is int16_t. There seems to be inconsistency in IEEE 802.1AS-2011:
in 6.3.3.8 ClockQualityoffsetScaledLogVariance is defined as UInteger16;
later in the document it's used as Integer16 (Table 14-1, code examples etc.);
This inconsistency has been corrected in IEEE 802.1AS-2011/Cor 1-2013 where UInteger16 was specified in the Table 14-1 and later in the code examples.
Static code analysis fix _032 (Issue Avnu#65)
SCA complains here about ntohs() but the real issue is the type of offsetScaledLogVariance,
which currently in the code is int16_t. There seems to be inconsistency in IEEE 802.1AS-2011:
- in 6.3.3.8 ClockQuality offsetScaledLogVariance is defined as UInteger16;
- later in the document it's used as Integer16 (Table 14-1, code examples etc.);
This inconsistency has been corrected in IEEE 802.1AS-2011/Cor 1-2013 where UInteger16 was specified
in the Table 14-1 and used later in the code examples.
Short summary (details in attached file):
SCA complains here about ntohs() but I believe the real issue is the type of offsetScaledLogVariance in struct ClockQuality, which currently in the code is int16_t. There seems to be inconsistency in IEEE 802.1AS-2011:
This inconsistency has been corrected in IEEE 802.1AS-2011/Cor 1-2013 where UInteger16 was specified in the Table 14-1 and later in the code examples.
gptp_032.txt
The text was updated successfully, but these errors were encountered: