diff --git a/cpu/native/periph/random.c b/cpu/native/periph/random.c index 25e597a95da62839e1ca3dc79451e2a71b784796..9fe1dcae10969b8dea0ae8af06e588c214dda947 100644 --- a/cpu/native/periph/random.c +++ b/cpu/native/periph/random.c @@ -92,7 +92,6 @@ int random_read(char *buf, unsigned int num) num = _native_rng_read_det(buf, num); break; default: - num = 0; err(EXIT_FAILURE, "random_read: _native_rng_mode is in invalid state %i\n", _native_rng_mode); break; diff --git a/sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c b/sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c index db08d7e68e11265fc5c3947299ac5a8b5ab5bad2..889f0111b92d1d079d6519cad07a7c4a34c58de3 100644 --- a/sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c +++ b/sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c @@ -364,7 +364,9 @@ static inline void _addr_set_multicast(uint8_t *dst, ng_pktsnip_t *payload) case NG_NETTYPE_IPV6: dst[0] = 0x33; dst[1] = 0x33; - memcpy(dst + 2, ((uint8_t *)payload->data) + _IPV6_DST_OFFSET, 4); + if ((payload != NULL) && (payload->data != NULL)) { + memcpy(dst + 2, ((uint8_t *)payload->data) + _IPV6_DST_OFFSET, 4); + } /* TODO change to proper types when ng_ipv6_hdr_t got merged */ break; #endif diff --git a/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c b/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c index a27734fc007e33a9ae3d538898e199be59444324..95560763239c3156ec67c1e1450aed32f89e6e00 100644 --- a/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c +++ b/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c @@ -62,10 +62,14 @@ void ng_icmpv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt) LL_SEARCH_SCALAR(pkt, icmpv6, type, NG_NETTYPE_ICMPV6); + assert(icmpv6 != NULL); + /* there can be extension headers between IPv6 and ICMPv6 header so we have * to search it */ LL_SEARCH_SCALAR(icmpv6, ipv6, type, NG_NETTYPE_IPV6); + assert(ipv6 != NULL); + hdr = (ng_icmpv6_hdr_t *)icmpv6->data; if (_calc_csum(icmpv6, ipv6, pkt)) { diff --git a/sys/net/network_layer/ng_ipv6/ng_ipv6.c b/sys/net/network_layer/ng_ipv6/ng_ipv6.c index 02f6f96a4fe5dfe4cb21917262ff1c12ef23a5e0..328d7f5ebb39b0426d5448d9dbcba97c111e74e3 100644 --- a/sys/net/network_layer/ng_ipv6/ng_ipv6.c +++ b/sys/net/network_layer/ng_ipv6/ng_ipv6.c @@ -593,6 +593,8 @@ static void _receive(ng_pktsnip_t *pkt) ng_pktsnip_t *ipv6, *netif; ng_ipv6_hdr_t *hdr; + assert(pkt != NULL); + LL_SEARCH_SCALAR(pkt, netif, type, NG_NETTYPE_NETIF); if (netif != NULL) { diff --git a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c index 809a66431015531543ebee66d7227b86af52b6e2..f2c60f199e3b75b3ca808f3b208030ee36a17f35 100644 --- a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c +++ b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c @@ -237,6 +237,9 @@ static void _send(ng_pktsnip_t *pkt) payload_len++; } #else + /* suppress clang-analyzer report about iface being not read */ + (void) iface; + DEBUG("6lo: Send uncompressed\n"); sixlowpan = ng_pktbuf_add(NULL, NULL, sizeof(uint8_t), NG_NETTYPE_SIXLOWPAN); diff --git a/sys/net/transport_layer/ng_udp/ng_udp.c b/sys/net/transport_layer/ng_udp/ng_udp.c index 6787d9bd0c7bb4bc192722c2058194bd1a27e914..4e3f0ce27dae968abeb123c12504100b5a229584 100644 --- a/sys/net/transport_layer/ng_udp/ng_udp.c +++ b/sys/net/transport_layer/ng_udp/ng_udp.c @@ -120,6 +120,8 @@ static void _receive(ng_pktsnip_t *pkt) LL_SEARCH_SCALAR(pkt, ipv6, type, NG_NETTYPE_IPV6); + assert(ipv6 != NULL); + /* validate checksum */ if (_calc_csum(udp, ipv6, pkt)) { DEBUG("udp: received packet with invalid checksum, dropping it\n"); @@ -144,6 +146,9 @@ static void _send(ng_pktsnip_t *pkt) /* get udp snip and hdr */ LL_SEARCH_SCALAR(pkt, udp_snip, type, NG_NETTYPE_UDP); + + assert(udp_snip != NULL); + udp_snip = ng_pktbuf_start_write(udp_snip); if (udp_snip == NULL) { DEBUG("udp: cannot send packet: unable to allocate packet\n");