diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2000-12-08 21:51:06 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2000-12-08 21:51:06 +0000 |
commit | dd75d1d73b4f3034c1d9f621a49fff58b1d71eb1 (patch) | |
tree | 197ae73617ae75afe008897f6906b84835589ea2 /sys/net | |
parent | ed5dbfbd3cd619638a7baac288f548aa1398edac (diff) | |
download | FreeBSD-src-dd75d1d73b4f3034c1d9f621a49fff58b1d71eb1.zip FreeBSD-src-dd75d1d73b4f3034c1d9f621a49fff58b1d71eb1.tar.gz |
Convert more malloc+bzero to malloc+M_ZERO.
Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bpf.c | 3 | ||||
-rw-r--r-- | sys/net/bridge.c | 3 | ||||
-rw-r--r-- | sys/net/if.c | 9 | ||||
-rw-r--r-- | sys/net/if_ef.c | 4 | ||||
-rw-r--r-- | sys/net/if_sl.c | 3 | ||||
-rw-r--r-- | sys/net/if_tap.c | 3 | ||||
-rw-r--r-- | sys/net/if_tun.c | 3 | ||||
-rw-r--r-- | sys/net/rtsock.c | 4 |
8 files changed, 12 insertions, 20 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 5ee63df..d2eaa39 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -366,8 +366,7 @@ bpfopen(dev, flags, fmt, p) if ((dev->si_flags & SI_NAMED) == 0) make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, "bpf%d", dev2unit(dev)); - MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK); - bzero(d, sizeof(*d)); + MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO); dev->si_drv1 = d; d->bd_bufsize = bpf_bufsize; d->bd_sig = SIGIO; diff --git a/sys/net/bridge.c b/sys/net/bridge.c index 00fce3a..0ab2cba 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -443,8 +443,7 @@ bdginit(void *dummy) flush_table(); ifp2sc = malloc(BDG_MAX_PORTS * sizeof(struct bdg_softc), - M_IFADDR, M_WAITOK ); - bzero(ifp2sc, BDG_MAX_PORTS * sizeof(struct bdg_softc) ); + M_IFADDR, M_WAITOK | M_ZERO); bzero(&bdg_stats, sizeof(bdg_stats) ); bdgtakeifaces(); diff --git a/sys/net/if.c b/sys/net/if.c index cb77a31..0c6fc84 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -167,8 +167,7 @@ if_attach(ifp) getmicrotime(&ifp->if_lastchange); if (ifnet_addrs == 0 || if_index >= if_indexlim) { unsigned n = (if_indexlim <<= 1) * sizeof(ifa); - caddr_t q = malloc(n, M_IFADDR, M_WAITOK); - bzero(q, n); + caddr_t q = malloc(n, M_IFADDR, M_WAITOK | M_ZERO); if (ifnet_addrs) { bcopy((caddr_t)ifnet_addrs, (caddr_t)q, n/2); free((caddr_t)ifnet_addrs, M_IFADDR); @@ -177,8 +176,7 @@ if_attach(ifp) /* grow ifindex2ifnet */ n = if_indexlim * sizeof(struct ifnet *); - q = malloc(n, M_IFADDR, M_WAITOK); - bzero(q, n); + q = malloc(n, M_IFADDR, M_WAITOK | M_ZERO); if (ifindex2ifnet) { bcopy((caddr_t)ifindex2ifnet, q, n/2); free((caddr_t)ifindex2ifnet, M_IFADDR); @@ -203,9 +201,8 @@ if_attach(ifp) socksize = sizeof(*sdl); socksize = ROUNDUP(socksize); ifasize = sizeof(*ifa) + 2 * socksize; - ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK); + ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); if (ifa) { - bzero((caddr_t)ifa, ifasize); sdl = (struct sockaddr_dl *)(ifa + 1); sdl->sdl_len = socksize; sdl->sdl_family = AF_LINK; diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index f8e38ca..4554a29 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -492,10 +492,10 @@ ef_clone(struct ef_link *efl, int ft) char cbuf[IFNAMSIZ], *ifname; int ifnlen; - efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, M_WAITOK); + efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, + M_WAITOK | M_ZERO); if (efp == NULL) return ENOMEM; - bzero(efp, sizeof(*efp)); efp->ef_ifp = ifp; eifp = &efp->ef_ac.ac_if; ifnlen = 1 + snprintf(cbuf, sizeof(cbuf), "%s%df", ifp->if_name, diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 50888ee..f7bc1f2 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -251,8 +251,7 @@ slcreate() int unit; struct mbuf *m; - MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK); - bzero(sc, sizeof *sc); + MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO); m = m_gethdr(M_WAIT, MT_DATA); if (m != NULL) { diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 6c88075..504c932 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -205,8 +205,7 @@ tapcreate(dev) char *name = NULL; /* allocate driver storage and create device */ - MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK); - bzero(tp, sizeof(*tp)); + MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO); /* select device: tap or vmnet */ if (minor(dev) & VMNET_DEV_MASK) { diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index bc1e2c6..c7047a7 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -147,8 +147,7 @@ tuncreate(dev) dev = make_dev(&tun_cdevsw, minor(dev), UID_UUCP, GID_DIALER, 0600, "tun%d", dev2unit(dev)); - MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK); - bzero(sc, sizeof *sc); + MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); sc->tun_flags = TUN_INITED; ifp = &sc->tun_if; diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index d778e01..d9b4b10 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -108,10 +108,10 @@ rts_attach(struct socket *so, int proto, struct proc *p) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ - MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK); /* XXX */ + /* XXX */ + MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO); if (rp == 0) return ENOBUFS; - bzero(rp, sizeof *rp); /* * The splnet() is necessary to block protocols from sending |