Skip to content

Commit 3b46d8d

Browse files
author
Arto Kinnunen
authored
Fix defects found by coverity (ARMmbed#1529)
Fix CID: 223399 Unchecked return value from library Fix CID: 223400, 223401, 223404: Null pointer dereferences
1 parent 3a57101 commit 3b46d8d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

source/6LoWPAN/Thread/thread_extension_bbr.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ static int thread_extension_bbr_mlr_cb(int8_t service_id, uint8_t source_address
571571
(void)source_address;
572572
(void)source_port;
573573

574+
protocol_interface_info_entry_t *cur;
575+
sn_coap_msg_code_e response_code = COAP_MSG_CODE_RESPONSE_CHANGED;
574576
uint16_t addr_len;
575577
uint16_t session_id;
576578
uint8_t *addr_data_ptr;
@@ -583,12 +585,15 @@ static int thread_extension_bbr_mlr_cb(int8_t service_id, uint8_t source_address
583585
tr_info("Thread BBR MLR.ntf receive");
584586

585587
thread_pbbr_t *this = thread_border_router_find_by_service(service_id);
586-
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(this->interface_id);
587-
sn_coap_msg_code_e response_code = COAP_MSG_CODE_RESPONSE_CHANGED;
588-
589588
if (!this) {
590589
return -1;
591590
}
591+
592+
cur = protocol_stack_interface_info_get_by_id(this->interface_id);
593+
if (!cur) {
594+
return -1;
595+
}
596+
592597
ptr = payload;
593598

594599
// Set default value if not specified in message.

source/6LoWPAN/Thread/thread_joiner_application.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,8 @@ void thread_joiner_pending_config_activate(int8_t interface_id)
11221122

11231123
if (master_key_ptr && memcmp(master_key_ptr,link_configuration->master_key,16) != 0) {
11241124
this->configuration_ptr->key_sequence = 0;
1125-
thread_nvm_store_seq_counter_write(this->configuration_ptr->key_sequence);
1125+
// if write fails, keep going...
1126+
(void)thread_nvm_store_seq_counter_write(this->configuration_ptr->key_sequence);
11261127
}
11271128

11281129
tr_info("*** Activating pending configuration.");

0 commit comments

Comments
 (0)