summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-11-13 10:33:13 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-11-13 10:33:13 +0000
commitfbd4873807a5947cb4cb925b0b6119e0fbcd1bde (patch)
tree819da3f73af735c794fe5d27364c28a537cf879a
parent5ccde455fa5e4ac939f285ce7e06f1acf9be1204 (diff)
Do not cast malloc(9) results.
-rw-r--r--sys/netinet/ip_mroute.c11
-rw-r--r--sys/netinet6/ip6_mroute.c9
2 files changed, 7 insertions, 13 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 2bdb34e89dc..78e7abd5afe 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.87 2015/11/13 10:25:48 mpi Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.88 2015/11/13 10:33:12 mpi Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -1159,8 +1159,7 @@ add_mfc(struct mbuf *m)
}
}
if (rt == NULL) { /* no upcall, so make a new entry */
- rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE,
- M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
splx(s);
return (ENOBUFS);
@@ -1327,8 +1326,7 @@ ip_mforward(struct mbuf *m, struct ifnet *ifp)
* just going to fail anyway. Make sure to pullup the header so
* that other people can't step on it.
*/
- rte = (struct rtdetq *)malloc(sizeof(*rte),
- M_MRTABLE, M_NOWAIT);
+ rte = malloc(sizeof(*rte), M_MRTABLE, M_NOWAIT);
if (rte == NULL) {
splx(s);
return (ENOBUFS);
@@ -1366,8 +1364,7 @@ ip_mforward(struct mbuf *m, struct ifnet *ifp)
goto non_fatal;
/* no upcall, so make a new entry */
- rt = (struct mfc *)malloc(sizeof(*rt),
- M_MRTABLE, M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL)
goto fail;
/*
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 05fb95fb4f9..4fcaae17ba2 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -859,8 +859,7 @@ add_m6fc(struct mf6cctl *mfccp)
}
if (rt == NULL) {
/* no upcall, so make a new entry */
- rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE,
- M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
splx(s);
return ENOBUFS;
@@ -1022,8 +1021,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
* Allocate mbufs early so that we don't do extra work if we
* are just going to fail anyway.
*/
- rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE,
- M_NOWAIT);
+ rte = malloc(sizeof(*rte), M_MRTABLE, M_NOWAIT);
if (rte == NULL) {
splx(s);
return ENOBUFS;
@@ -1057,8 +1055,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
struct mrt6msg *im;
/* no upcall, so make a new entry */
- rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE,
- M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
free(rte, M_MRTABLE, 0);
m_freem(mb0);