summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/icmp6.c
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2005-04-14 11:41:23 +0000
committergnn <gnn@FreeBSD.org>2005-04-14 11:41:23 +0000
commit8006d90653e02601be0ed3190e1601b45508aeb7 (patch)
treecf9f3eb643c397a4fbbef134683267d494e99ebd /sys/netinet6/icmp6.c
parent08ff41b73d58eff36c650fa7d3478e99c9f1a0b8 (diff)
downloadFreeBSD-src-8006d90653e02601be0ed3190e1601b45508aeb7.zip
FreeBSD-src-8006d90653e02601be0ed3190e1601b45508aeb7.tar.gz
Remove dead code which would never execute.
i.e. checking to see if a cluster was every less than 48 bytes, a rather unlikely case. Check return value of m_dup_pkthdr() calls. Found by: Coverity Reviewed by: rwatson (mentor), Keiichi Shima (for Kame) Approved by: rwatson (mentor)
Diffstat (limited to 'sys/netinet6/icmp6.c')
-rw-r--r--sys/netinet6/icmp6.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index a6f0f05..5ab4203 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -524,15 +524,6 @@ icmp6_input(mp, offp, proto)
const int maxlen = sizeof(*nip6) + sizeof(*nicmp6);
int n0len;
- /*
- * Prepare an internal mbuf. m_pullup() doesn't
- * always copy the length we specified.
- */
- if (maxlen >= MCLBYTES) {
- /* Give up remote */
- m_freem(n0);
- break;
- }
MGETHDR(n, M_DONTWAIT, n0->m_type);
n0len = n0->m_pkthdr.len; /* save for use below */
if (n)
@@ -1943,9 +1934,14 @@ icmp6_rip6_input(mp, off)
m->m_len <= MHLEN) {
MGET(n, M_DONTWAIT, m->m_type);
if (n != NULL) {
- m_dup_pkthdr(n, m, M_NOWAIT);
- bcopy(m->m_data, n->m_data, m->m_len);
- n->m_len = m->m_len;
+ if (m_dup_pkthdr(n, m, M_NOWAIT)) {
+ bcopy(m->m_data, n->m_data,
+ m->m_len);
+ n->m_len = m->m_len;
+ } else {
+ m_free(n);
+ n = NULL;
+ }
}
}
if (n != NULL ||
@@ -1983,12 +1979,16 @@ icmp6_rip6_input(mp, off)
MGET(n, M_DONTWAIT, m->m_type);
if (n != NULL) {
- m_dup_pkthdr(n, m, M_NOWAIT);
- bcopy(m->m_data, n->m_data, m->m_len);
- n->m_len = m->m_len;
-
- m_freem(m);
- m = n;
+ if (m_dup_pkthdr(n, m, M_NOWAIT)) {
+ bcopy(m->m_data, n->m_data, m->m_len);
+ n->m_len = m->m_len;
+
+ m_freem(m);
+ m = n;
+ } else {
+ m_freem(n);
+ n = NULL;
+ }
}
}
if (sbappendaddr(&last->in6p_socket->so_rcv,
OpenPOWER on IntegriCloud