Skip to content

Commit

Permalink
Fix issues found by coverity (ARMmbed#1889)
Browse files Browse the repository at this point in the history
- 277905 Unchecked return value from library
- 277906 Unchecked return value from library
- 270649 Uninitialized scalar variable
  • Loading branch information
Arto Kinnunen authored Nov 1, 2018
1 parent c81e59c commit dc404c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_joiner_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ void thread_joiner_pending_config_activate(int8_t interface_id)
this->active_configuration_ptr->timestamp = pending_active_timestamp;
// All information is copied from old configuration so if configuration is corrupt we dont change anything.
this->pending_configuration_ptr = NULL;
(void)thread_nvm_store_pending_configuration_remove();
thread_nvm_store_pending_configuration_remove();
configuration_set_copy_mandatory(this->active_configuration_ptr, this->old_active_configuration_ptr);
link_configuration_update(this->configuration_ptr,this->active_configuration_ptr->data, this->active_configuration_ptr->length);
link_configuration_trace(this->configuration_ptr);
Expand Down
12 changes: 10 additions & 2 deletions source/6LoWPAN/Thread/thread_nvm_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ int thread_nvm_store_active_configuration_remove(void)
}
char ac_data_path[ACTIVE_CONF_STRING_LEN];
thread_nvm_store_create_path(ac_data_path, THREAD_NVM_ACTIVE_CONF_FILE);
return remove(ac_data_path);
int status = remove(ac_data_path);
if (status != 0) {
return THREAD_NVM_FILE_REMOVE_ERROR;
}
return THREAD_NVM_FILE_SUCCESS;
}

int thread_nvm_store_pending_configuration_remove(void)
Expand All @@ -302,7 +306,11 @@ int thread_nvm_store_pending_configuration_remove(void)
}
char ac_data_path[PENDING_CONF_STRING_LEN];
thread_nvm_store_create_path(ac_data_path, THREAD_NVM_PENDING_CONF_FILE);
return remove(ac_data_path);
int status = remove(ac_data_path);
if (status != 0) {
return THREAD_NVM_FILE_REMOVE_ERROR;
}
return THREAD_NVM_FILE_SUCCESS;
}


Expand Down
8 changes: 6 additions & 2 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,12 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
// Saved from unicast IE
cur->ws_info->parent_info.ws_us = *ws_us;

// Saved from Pan information
cur->ws_info->parent_info.pan_information = pan_information;
// Saved from Pan information, do not overwrite pan_version as it is not valid here
cur->ws_info->parent_info.pan_information.pan_size = pan_information.pan_size;
cur->ws_info->parent_info.pan_information.routing_cost = pan_information.routing_cost;
cur->ws_info->parent_info.pan_information.use_parent_bs = pan_information.use_parent_bs;
cur->ws_info->parent_info.pan_information.rpl_routing_method = pan_information.rpl_routing_method;
cur->ws_info->parent_info.pan_information.version = pan_information.version;

// Saved from message
cur->ws_info->parent_info.timestamp = data->timestamp;
Expand Down

0 comments on commit dc404c4

Please sign in to comment.