mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +00:00
[examples] fix potential unaligned pointer value (#4323)
Fixes applied to cc1352, cc2650, and cc2652 platforms.
This commit is contained in:
@@ -1575,14 +1575,15 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx(&extAddress);
|
||||
|
||||
if (idx == CC1352_SRC_MATCH_NONE)
|
||||
{
|
||||
/* the entry does not exist already, add it */
|
||||
otEXPECT_ACTION((idx = rfCoreFindEmptyExtSrcMatchIdx()) != CC1352_SRC_MATCH_NONE, error = OT_ERROR_NO_BUFS);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = *((uint64_t *)aExtAddress);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = extAddress;
|
||||
}
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
@@ -1608,10 +1609,11 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx;
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx;
|
||||
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC1352_SRC_MATCH_NONE,
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx(&extAddress)) != CC1352_SRC_MATCH_NONE,
|
||||
error = OT_ERROR_NO_ADDRESS);
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
|
||||
@@ -1526,14 +1526,15 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx(&extAddress);
|
||||
|
||||
if (idx == CC2650_SRC_MATCH_NONE)
|
||||
{
|
||||
/* the entry does not exist already, add it */
|
||||
otEXPECT_ACTION((idx = rfCoreFindEmptyExtSrcMatchIdx()) != CC2650_SRC_MATCH_NONE, error = OT_ERROR_NO_BUFS);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = *((uint64_t *)aExtAddress);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = extAddress;
|
||||
}
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
@@ -1559,10 +1560,11 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx;
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx;
|
||||
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC2650_SRC_MATCH_NONE,
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx(&extAddress)) != CC2650_SRC_MATCH_NONE,
|
||||
error = OT_ERROR_NO_ADDRESS);
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
|
||||
@@ -1556,14 +1556,15 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx = rfCoreFindExtSrcMatchIdx(&extAddress);
|
||||
|
||||
if (idx == CC2652_SRC_MATCH_NONE)
|
||||
{
|
||||
/* the entry does not exist already, add it */
|
||||
otEXPECT_ACTION((idx = rfCoreFindEmptyExtSrcMatchIdx()) != CC2652_SRC_MATCH_NONE, error = OT_ERROR_NO_BUFS);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = *((uint64_t *)aExtAddress);
|
||||
sSrcMatchExtData.extAddrEnt[idx] = extAddress;
|
||||
}
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
@@ -1589,10 +1590,11 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t idx;
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint64_t extAddress = *(uint64_t *)aExtAddress;
|
||||
uint8_t idx;
|
||||
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC2652_SRC_MATCH_NONE,
|
||||
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx(&extAddress)) != CC2652_SRC_MATCH_NONE,
|
||||
error = OT_ERROR_NO_ADDRESS);
|
||||
|
||||
if (sReceiveCmd.status == ACTIVE || sReceiveCmd.status == IEEE_SUSPENDED)
|
||||
|
||||
Reference in New Issue
Block a user