aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorGeorge V. Neville-Neil <gnn@FreeBSD.org>2005-05-15 02:28:30 +0000
committerGeorge V. Neville-Neil <gnn@FreeBSD.org>2005-05-15 02:28:30 +0000
commit403cbcf59f3e33182e81fe2e52c4f44d4d6dabda (patch)
tree0bf3963d121c2edbe8546d00ad1b734f627e3ec4 /sys/netinet6
parent1771f872d52e4cf9f8650dfd755f4e5d5bbd48a4 (diff)
downloadsrc-403cbcf59f3e33182e81fe2e52c4f44d4d6dabda.tar.gz
src-403cbcf59f3e33182e81fe2e52c4f44d4d6dabda.zip
Fixes for various nits found by the Coverity tool.
In particular 2 missed return values and an inappropriate bcopy from a possibly NULL pointer. Reviewed by: jake Approved by: rwatson MFC after: 1 week
Notes
Notes: svn path=/head/; revision=146228
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/icmp6.c7
-rw-r--r--sys/netinet6/in6_src.c2
-rw-r--r--sys/netinet6/ip6_fw.c2
-rw-r--r--sys/netinet6/ip6_output.c2
4 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 5ab4203ac35c..3f3cbd67bdce 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2092,13 +2092,16 @@ icmp6_reflect(m, off)
sa6_src.sin6_len = sizeof(sa6_src);
sa6_src.sin6_addr = ip6->ip6_dst;
in6_recoverscope(&sa6_src, &ip6->ip6_dst, m->m_pkthdr.rcvif);
- in6_embedscope(&ip6->ip6_dst, &sa6_src, NULL, NULL);
+ if (in6_embedscope(&ip6->ip6_dst, &sa6_src, NULL, NULL))
+ goto bad;
+
bzero(&sa6_dst, sizeof(sa6_dst));
sa6_dst.sin6_family = AF_INET6;
sa6_dst.sin6_len = sizeof(sa6_dst);
sa6_dst.sin6_addr = t;
in6_recoverscope(&sa6_dst, &t, m->m_pkthdr.rcvif);
- in6_embedscope(&t, &sa6_dst, NULL, NULL);
+ if (in6_embedscope(&t, &sa6_dst, NULL, NULL))
+ goto bad;
#ifdef COMPAT_RFC1885
/*
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index a969d916b04e..812b03d66650 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -667,7 +667,7 @@ in6_selectroute(dstsock, opts, mopts, ro, retifp, retrt, clone)
* (this may happen when we are sending a packet to one of
* our own addresses.)
*/
- if (opts && opts->ip6po_pktinfo &&
+ if (ifp && opts && opts->ip6po_pktinfo &&
opts->ip6po_pktinfo->ipi6_ifindex) {
if (!(ifp->if_flags & IFF_LOOPBACK) &&
ifp->if_index !=
diff --git a/sys/netinet6/ip6_fw.c b/sys/netinet6/ip6_fw.c
index a399b8b54d8d..30a176a443aa 100644
--- a/sys/netinet6/ip6_fw.c
+++ b/sys/netinet6/ip6_fw.c
@@ -769,7 +769,7 @@ got_match:
* - The packet is not an ICMP packet, or is an ICMP query packet
* - The packet is not a multicast or broadcast packet
*/
- if ((rule->fw_flg & IPV6_FW_F_COMMAND) == IPV6_FW_F_REJECT
+ if (rule && (rule->fw_flg & IPV6_FW_F_COMMAND) == IPV6_FW_F_REJECT
&& (nxt != IPPROTO_ICMPV6 || is_icmp6_query(ip6, off))
&& !((*m)->m_flags & (M_BCAST|M_MCAST))
&& !IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 36cfb289f50b..265bd9ed70c6 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -2603,7 +2603,7 @@ ip6_copypktopts(src, canwait)
if (src->ip6po_nexthop) {
dst->ip6po_nexthop = malloc(src->ip6po_nexthop->sa_len,
M_IP6OPT, canwait);
- if (dst->ip6po_nexthop == NULL && canwait == M_NOWAIT)
+ if (dst->ip6po_nexthop == NULL)
goto bad;
bcopy(src->ip6po_nexthop, dst->ip6po_nexthop,
src->ip6po_nexthop->sa_len);