Skip to content

Commit

Permalink
Corrected coverity, compiler and astyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mika Leppänen committed Feb 26, 2019
1 parent 96c5496 commit ac51ec5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions source/6LoWPAN/ws/ws_pae_auth.c
Expand Up @@ -579,9 +579,9 @@ void ws_pae_auth_slow_timer(uint16_t seconds)

pae_auth->slow_timer_seconds += seconds;
if (pae_auth->slow_timer_seconds > 60) {
ws_pae_lib_supp_list_slow_timer_update(&pae_auth->active_supp_list, pae_auth->timer_settings, pae_auth->slow_timer_seconds);
ws_pae_lib_supp_list_slow_timer_update(&pae_auth->inactive_supp_list, pae_auth->timer_settings, pae_auth->slow_timer_seconds);
pae_auth->slow_timer_seconds = 0;
ws_pae_lib_supp_list_slow_timer_update(&pae_auth->active_supp_list, pae_auth->timer_settings, pae_auth->slow_timer_seconds);
ws_pae_lib_supp_list_slow_timer_update(&pae_auth->inactive_supp_list, pae_auth->timer_settings, pae_auth->slow_timer_seconds);
pae_auth->slow_timer_seconds = 0;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions source/6LoWPAN/ws/ws_pae_controller.c
Expand Up @@ -677,12 +677,12 @@ int8_t ws_pae_controller_certificate_revocation_list_remove(const arm_cert_revoc
sec_prot_certs_revocat_list_set(cert_revoc_list, crl->crl, crl->crl_len);

ns_list_foreach(pae_controller_t, entry, &pae_controller_list) {
cert_revocat_list_entry_t *removed_cert_revoc_list = sec_prot_certs_revocat_lists_entry_find(&entry->certs.cert_revocat_lists, cert_revoc_list);
if (removed_cert_revoc_list) {
sec_prot_certs_revocat_lists_entry_delete(&entry->certs.cert_revocat_lists, removed_cert_revoc_list);
ret = 0;
}
}
cert_revocat_list_entry_t *removed_cert_revoc_list = sec_prot_certs_revocat_lists_entry_find(&entry->certs.cert_revocat_lists, cert_revoc_list);
if (removed_cert_revoc_list) {
sec_prot_certs_revocat_lists_entry_delete(&entry->certs.cert_revocat_lists, removed_cert_revoc_list);
ret = 0;
}
}

sec_prot_certs_revocat_list_entry_delete(cert_revoc_list);

Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/ws/ws_pae_nvm_store.c
Expand Up @@ -161,6 +161,7 @@ static int8_t ws_pae_nvm_store_read(const char *file_name, nvm_tlv_list_t *tlv_l

while (list_count-- > 0) {
nvm_tlv_entry_t entry_header;
memset(&entry_header, 0, sizeof(nvm_tlv_entry_t));
n_bytes = fread(&entry_header.tag, 1, NVM_TLV_FIXED_LEN, fp);
if (n_bytes != NVM_TLV_FIXED_LEN) {
failure = true;
Expand Down
2 changes: 1 addition & 1 deletion source/NWK_INTERFACE/protocol_core.c
Expand Up @@ -342,7 +342,7 @@ void core_timer_event_handle(uint16_t ticksUpdate)
icmpv6_radv_timer(ticksUpdate);
protocol_core_security_tick_update(ticksUpdate);
#ifdef HAVE_WS
ws_pae_controller_fast_timer(ticksUpdate);
ws_pae_controller_fast_timer(ticksUpdate);
#endif
platform_enter_critical();
protocol_core_timer_info.core_timer_event = false;
Expand Down
8 changes: 4 additions & 4 deletions source/Security/protocols/sec_prot_keys.c
Expand Up @@ -284,7 +284,7 @@ void sec_prot_keys_gtkl_set(sec_prot_keys_t *sec_keys, uint8_t gtkl)

bool sec_prot_keys_gtkl_gtk_is_live(sec_prot_keys_t *sec_keys, uint8_t index)
{
if (index > GTK_NUM) {
if (index >= GTK_NUM) {
return false;
}

Expand All @@ -297,7 +297,7 @@ bool sec_prot_keys_gtkl_gtk_is_live(sec_prot_keys_t *sec_keys, uint8_t index)

int8_t sec_prot_keys_gtkl_gtk_live_set(sec_prot_keys_t *sec_keys, uint8_t index)
{
if (index > GTK_NUM) {
if (index >= GTK_NUM) {
return -1;
}

Expand All @@ -308,7 +308,7 @@ int8_t sec_prot_keys_gtkl_gtk_live_set(sec_prot_keys_t *sec_keys, uint8_t index)

int8_t sec_prot_keys_gtk_insert_index_set(sec_prot_keys_t *sec_keys, uint8_t index)
{
if (index > GTK_NUM || !sec_keys->gtks->gtk[index].set) {
if (index >= GTK_NUM || !sec_keys->gtks->gtk[index].set) {
return -1;
}

Expand Down Expand Up @@ -689,7 +689,7 @@ int8_t sec_prot_keys_gtk_install_order_second_index_get(sec_prot_gtk_keys_t *gtk

void sec_prot_keys_gtk_install_order_update(sec_prot_gtk_keys_t *gtks)
{
int8_t ordered_indexes[4] = {-1,-1,-1,-1};
int8_t ordered_indexes[4] = {-1, -1, -1, -1};

// Creates table of ordered indexes
for (uint8_t i = 0; i < GTK_NUM; i++) {
Expand Down
4 changes: 2 additions & 2 deletions source/libNET/src/ns_net.c
Expand Up @@ -969,7 +969,7 @@ int8_t arm_network_certificate_revocation_list_add(const arm_cert_revocation_lis
#ifdef HAVE_WS
return ws_pae_controller_certificate_revocation_list_add(crl);
#else
(void) cert;
(void) crl;
return -1;
#endif
}
Expand All @@ -979,7 +979,7 @@ int8_t arm_network_certificate_revocation_list_remove(const arm_cert_revocation_
#ifdef HAVE_WS
return ws_pae_controller_certificate_revocation_list_remove(crl);
#else
(void) cert;
(void) crl;
return -1;
#endif
}
Expand Down

0 comments on commit ac51ec5

Please sign in to comment.