Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 90a36a6

Browse files
coverity reported error fixes. (ARMmbed#1770)
CIDs 271912, 271441, and 270647 are fixed by this pull request.
1 parent 9644114 commit 90a36a6

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

source/6LoWPAN/Thread/thread_extension_bbr.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,16 @@ static int thread_extension_bbr_pbbr_start(thread_pbbr_t *this)
10781078
this->pbbr_multicast_address[1] = 0x32; //Thread specification says p and t bits are 1
10791079
this->pbbr_multicast_address[2] = 0x00; //Reserved
10801080
this->pbbr_multicast_address[3] = 0x40; //Prefix length 64 bits
1081-
thread_extension_network_prefix_get(cur->id, NULL, &this->pbbr_multicast_address[4], NULL);
1081+
if (!thread_extension_network_prefix_get(cur->id, NULL, &this->pbbr_multicast_address[4], NULL)) {
1082+
this->pbbr_multicast_address[4] = 0xfd;
1083+
this->pbbr_multicast_address[5] = 0x00;
1084+
this->pbbr_multicast_address[6] = 0x7d;
1085+
this->pbbr_multicast_address[7] = 0x03;
1086+
this->pbbr_multicast_address[8] = 0x7d;
1087+
this->pbbr_multicast_address[9] = 0x03;
1088+
this->pbbr_multicast_address[10] = 0x7d;
1089+
this->pbbr_multicast_address[11] = 0x03;
1090+
}
10821091
this->pbbr_multicast_address[15] = 3;
10831092

10841093
tr_info("pBBR service started (Commercial network)");
@@ -1141,16 +1150,18 @@ int8_t thread_extension_bbr_init(int8_t interface_id, int8_t backbone_interface_
11411150
this->joiner_router_rloc = 0xffff;
11421151
this->coap_nmkp_virtual_service_id = -1;
11431152
this->br_bb_service_id = -1;
1144-
// Default domain prefix for PBBR
1145-
this->domain_prefix[0] = 0xfd;
1146-
this->domain_prefix[2] = 0x7d;
1147-
this->domain_prefix[3] = 0x03;
1148-
this->domain_prefix[4] = 0x7d;
1149-
this->domain_prefix[5] = 0x03;
1150-
this->domain_prefix[6] = 0x7d;
1151-
this->domain_prefix[7] = 0x03;
1152-
1153-
thread_extension_network_prefix_get(interface_id, NULL, this->domain_prefix, NULL);
1153+
// Default domain prefix for PBBR - will be updated once domain prefix is in network data
1154+
if (0 != thread_extension_network_prefix_get(interface_id, NULL, this->domain_prefix, NULL)) {
1155+
this->domain_prefix[0] = 0xfd;
1156+
this->domain_prefix[1] = 0x00;
1157+
this->domain_prefix[2] = 0x7d;
1158+
this->domain_prefix[3] = 0x03;
1159+
this->domain_prefix[4] = 0x7d;
1160+
this->domain_prefix[5] = 0x03;
1161+
this->domain_prefix[6] = 0x7d;
1162+
this->domain_prefix[7] = 0x03;
1163+
}
1164+
11541165
this->coap_service_id = coap_service_initialize(this->interface_id, THREAD_MANAGEMENT_PORT, COAP_SERVICE_OPTIONS_NONE, NULL, NULL);
11551166
if (this->coap_service_id < 0) {
11561167
tr_warn("Thread border router coap init failed");

source/6LoWPAN/Thread/thread_network_synch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void thread_dynamic_storage_build_mle_table(int8_t interface_id)
238238
{
239239
tr_debug("Dynamic storage: building MLE table.");
240240
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
241-
if (!cur && cur->mac_parameters) {
241+
if (!cur || !cur->mac_parameters) {
242242
return;
243243
}
244244

0 commit comments

Comments
 (0)