Skip to content

Commit dc404c4

Browse files
author
Arto Kinnunen
authored
Fix issues found by coverity (ARMmbed#1889)
- 277905 Unchecked return value from library - 277906 Unchecked return value from library - 270649 Uninitialized scalar variable
1 parent c81e59c commit dc404c4

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

source/6LoWPAN/Thread/thread_joiner_application.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ void thread_joiner_pending_config_activate(int8_t interface_id)
11401140
this->active_configuration_ptr->timestamp = pending_active_timestamp;
11411141
// All information is copied from old configuration so if configuration is corrupt we dont change anything.
11421142
this->pending_configuration_ptr = NULL;
1143-
(void)thread_nvm_store_pending_configuration_remove();
1143+
thread_nvm_store_pending_configuration_remove();
11441144
configuration_set_copy_mandatory(this->active_configuration_ptr, this->old_active_configuration_ptr);
11451145
link_configuration_update(this->configuration_ptr,this->active_configuration_ptr->data, this->active_configuration_ptr->length);
11461146
link_configuration_trace(this->configuration_ptr);

source/6LoWPAN/Thread/thread_nvm_store.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ int thread_nvm_store_active_configuration_remove(void)
292292
}
293293
char ac_data_path[ACTIVE_CONF_STRING_LEN];
294294
thread_nvm_store_create_path(ac_data_path, THREAD_NVM_ACTIVE_CONF_FILE);
295-
return remove(ac_data_path);
295+
int status = remove(ac_data_path);
296+
if (status != 0) {
297+
return THREAD_NVM_FILE_REMOVE_ERROR;
298+
}
299+
return THREAD_NVM_FILE_SUCCESS;
296300
}
297301

298302
int thread_nvm_store_pending_configuration_remove(void)
@@ -302,7 +306,11 @@ int thread_nvm_store_pending_configuration_remove(void)
302306
}
303307
char ac_data_path[PENDING_CONF_STRING_LEN];
304308
thread_nvm_store_create_path(ac_data_path, THREAD_NVM_PENDING_CONF_FILE);
305-
return remove(ac_data_path);
309+
int status = remove(ac_data_path);
310+
if (status != 0) {
311+
return THREAD_NVM_FILE_REMOVE_ERROR;
312+
}
313+
return THREAD_NVM_FILE_SUCCESS;
306314
}
307315

308316

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,12 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
834834
// Saved from unicast IE
835835
cur->ws_info->parent_info.ws_us = *ws_us;
836836

837-
// Saved from Pan information
838-
cur->ws_info->parent_info.pan_information = pan_information;
837+
// Saved from Pan information, do not overwrite pan_version as it is not valid here
838+
cur->ws_info->parent_info.pan_information.pan_size = pan_information.pan_size;
839+
cur->ws_info->parent_info.pan_information.routing_cost = pan_information.routing_cost;
840+
cur->ws_info->parent_info.pan_information.use_parent_bs = pan_information.use_parent_bs;
841+
cur->ws_info->parent_info.pan_information.rpl_routing_method = pan_information.rpl_routing_method;
842+
cur->ws_info->parent_info.pan_information.version = pan_information.version;
839843

840844
// Saved from message
841845
cur->ws_info->parent_info.timestamp = data->timestamp;

0 commit comments

Comments
 (0)