Skip to content

Commit

Permalink
Merge pull request #10358 from miri64/gnrc/fix/llvm-static-analyzer2
Browse files Browse the repository at this point in the history
gnrc_ipv6_nib: fix several issues found with LLVM's static code analyzer (only critical)
  • Loading branch information
miri64 committed Nov 9, 2018
2 parents 92a2c16 + 94549d1 commit 4671b18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sys/net/gnrc/network_layer/ipv6/nib/nib.c
Expand Up @@ -240,7 +240,7 @@ int gnrc_ipv6_nib_get_next_hop_l2addr(const ipv6_addr_t *dst,
gnrc_netif_acquire(netif);
}
node = _nib_onl_get(&route.next_hop,
(netif == NULL) ? netif->pid : 0);
(netif != NULL) ? netif->pid : 0);
if (_resolve_addr(&route.next_hop, netif, pkt, nce, node)) {
_call_route_info_cb(netif,
GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RN,
Expand Down
8 changes: 4 additions & 4 deletions sys/net/gnrc/network_layer/ipv6/nib/nib_pl.c
Expand Up @@ -29,7 +29,6 @@ int gnrc_ipv6_nib_pl_set(unsigned iface,
const ipv6_addr_t *pfx, unsigned pfx_len,
uint32_t valid_ltime, uint32_t pref_ltime)
{
int res = 0;
_nib_offl_entry_t *dst;
ipv6_addr_t tmp = IPV6_ADDR_UNSPECIFIED;

Expand All @@ -47,15 +46,16 @@ int gnrc_ipv6_nib_pl_set(unsigned iface,
dst = _nib_pl_add(iface, pfx, pfx_len, valid_ltime,
pref_ltime);
if (dst == NULL) {
res = -ENOMEM;
mutex_unlock(&_nib_mutex);
return -ENOMEM;
}
#ifdef MODULE_GNRC_NETIF
gnrc_netif_t *netif = gnrc_netif_get_by_pid(iface);
int idx;

if (netif == NULL) {
mutex_unlock(&_nib_mutex);
return res;
return 0;
}
gnrc_netif_acquire(netif);
if (!gnrc_netif_is_6ln(netif) &&
Expand Down Expand Up @@ -83,7 +83,7 @@ int gnrc_ipv6_nib_pl_set(unsigned iface,
/* update prefixes down-stream */
_handle_snd_mc_ra(netif);
#endif
return res;
return 0;
}

void gnrc_ipv6_nib_pl_del(unsigned iface,
Expand Down

0 comments on commit 4671b18

Please sign in to comment.