[static-analysis] address static code analysis issues (#6651)

We have run the static code analyser on the OpenThread code and some
issues were discovered.
This commit addresses those that were marked as High impact and were not
marked false positive after the inspection.

Signed-off-by: Marek Porwisz <[email protected]>
This commit is contained in:
Marek Porwisz
2021-05-24 17:22:07 -07:00
committed by GitHub
parent d0812fb4a0
commit abcf3ba152
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -272,12 +272,17 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError,
{
uint32_t frameCounter;
uint8_t keyId;
Error error;
IgnoreError(aFrame.GetFrameCounter(frameCounter));
error = aFrame.GetFrameCounter(frameCounter);
OT_ASSERT(error == kErrorNone);
aChild.SetIndirectFrameCounter(frameCounter);
IgnoreError(aFrame.GetKeyId(keyId));
error = aFrame.GetKeyId(keyId);
OT_ASSERT(error == kErrorNone);
aChild.SetIndirectKeyId(keyId);
OT_UNUSED_VARIABLE(error);
}
ExitNow();
+1 -1
View File
@@ -911,7 +911,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ASSISTING_PORT
{
uint16_t port;
IgnoreError(mDecoder.ReadUint16(port));
SuccessOrExit(error = mDecoder.ReadUint16(port));
SuccessOrExit(error = otIp6AddUnsecurePort(mInstance, port));
}