summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-06-17 18:19:45 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-06-17 18:19:45 +0000
commitdf0d019db60178be37cff40c992138c6d412c86c (patch)
tree2d1bbe7ec710ba685857f9b3c146180555d39422 /sys/net
parent9440ef4b35f66700755114e6509f782b4fd8a99c (diff)
Instead of bcopy() and bcmp() a single pointer in an mbuf tag,
assign with = and compare with == . This way the compiler will check deeper wether the cast is correct. Alignment is fine, tested on sparc64. OK claudio@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gif.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 5955b458862..f1c6e24b80b 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.61 2013/06/16 20:45:51 bluhm Exp $ */
+/* $OpenBSD: if_gif.c,v 1.62 2013/06/17 18:19:44 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -676,8 +676,7 @@ gif_checkloop(struct ifnet *ifp, struct mbuf *m)
*/
for (mtag = m_tag_find(m, PACKET_TAG_GIF, NULL); mtag;
mtag = m_tag_find(m, PACKET_TAG_GIF, mtag)) {
- if (!bcmp((caddr_t)(mtag + 1), &ifp,
- sizeof(struct ifnet *))) {
+ if (*(struct ifnet **)(mtag + 1) == ifp) {
log(LOG_NOTICE, "gif_output: "
"recursively called too many times\n");
m_freem(m);
@@ -685,12 +684,12 @@ gif_checkloop(struct ifnet *ifp, struct mbuf *m)
}
}
- mtag = m_tag_get(PACKET_TAG_GIF, sizeof(caddr_t), M_NOWAIT);
+ mtag = m_tag_get(PACKET_TAG_GIF, sizeof(struct ifnet *), M_NOWAIT);
if (mtag == NULL) {
m_freem(m);
return ENOMEM;
}
- bcopy(&ifp, mtag + 1, sizeof(caddr_t));
+ *(struct ifnet **)(mtag + 1) = ifp;
m_tag_prepend(m, mtag);
return 0;
}