From 29ae8cddb2ec660dd7311cb7bbaea7a920b82c67 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Tue, 18 Sep 2007 00:46:42 +0000 Subject: Only the most obvious bzero() -> M_ZERO changes. No cast changes, no MALLOC/FREE, etc. Just adding M_ZERO to malloc() and deleting an immediately adjacent bzero(). --- sys/dev/ic/ath.c | 5 ++--- sys/dev/ic/ciss.c | 8 +++----- sys/dev/ic/i82596.c | 5 ++--- sys/dev/ic/pgt.c | 8 +++----- 4 files changed, 10 insertions(+), 16 deletions(-) (limited to 'sys/dev/ic') diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 0936ffc6a1e..1ca938460ad 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.66 2007/07/18 18:10:31 damien Exp $ */ +/* $OpenBSD: ath.c,v 1.67 2007/09/18 00:46:41 krw Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -1613,14 +1613,13 @@ ath_desc_alloc(struct ath_softc *sc) /* allocate buffers */ bsize = sizeof(struct ath_buf) * (ATH_TXBUF + ATH_RXBUF + 1); - bf = malloc(bsize, M_DEVBUF, M_NOWAIT); + bf = malloc(bsize, M_DEVBUF, M_NOWAIT | M_ZERO); if (bf == NULL) { printf("%s: unable to allocate Tx/Rx buffers\n", sc->sc_dev.dv_xname); error = ENOMEM; goto fail3; } - bzero(bf, bsize); sc->sc_bufptr = bf; TAILQ_INIT(&sc->sc_rxbuf); diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index 260872fc2ba..ced349a564a 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciss.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */ +/* $OpenBSD: ciss.c,v 1.28 2007/09/18 00:46:41 krw Exp $ */ /* * Copyright (c) 2005,2006 Michael Shalayeff @@ -350,12 +350,11 @@ ciss_attach(struct ciss_softc *sc) } if (!(sc->sc_lds = malloc(sc->maxunits * sizeof(*sc->sc_lds), - M_DEVBUF, M_NOWAIT))) { + M_DEVBUF, M_NOWAIT | M_ZERO))) { bus_dmamem_free(sc->dmat, sc->cmdseg, 1); bus_dmamap_destroy(sc->dmat, sc->cmdmap); return -1; } - bzero(sc->sc_lds, sc->maxunits * sizeof(*sc->sc_lds)); sc->sc_flush = CISS_FLUSH_ENABLE; if (!(sc->sc_sh = shutdownhook_establish(ciss_shutdown, sc))) { @@ -422,9 +421,8 @@ ciss_attach(struct ciss_softc *sc) sc->sc_flags |= CISS_BIO; #ifndef SMALL_KERNEL sc->sensors = malloc(sizeof(struct ksensor) * sc->maxunits, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sensors) { - bzero(sc->sensors, sizeof(struct ksensor) * sc->maxunits); strlcpy(sc->sensordev.xname, sc->sc_dev.dv_xname, sizeof(sc->sensordev.xname)); for (i = 0; i < sc->maxunits; diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index 70f22039b3d..68b5fa015e8 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.27 2007/09/10 06:12:59 kettenis Exp $ */ +/* $OpenBSD: i82596.c,v 1.28 2007/09/18 00:46:41 krw Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -325,13 +325,12 @@ i82596_attach(sc, name, etheraddr, media, nmedia, defmedia) if (padbuf == NULL) { padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF, - M_NOWAIT); + M_NOWAIT | M_ZERO); if (padbuf == NULL) { printf("%s: can't allocate pad buffer\n", sc->sc_dev.dv_xname); return; } - bzero(padbuf, ETHER_MIN_LEN - ETHER_CRC_LEN); } /* Attach the interface. */ diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index 674172fa6b0..f5652536c8c 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.44 2007/08/28 18:34:38 deraadt Exp $ */ +/* $OpenBSD: pgt.c,v 1.45 2007/09/18 00:46:41 krw Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -1812,9 +1812,8 @@ pgt_ieee80211_node_alloc(struct ieee80211com *ic) { struct pgt_ieee80211_node *pin; - pin = malloc(sizeof(*pin), M_DEVBUF, M_NOWAIT); + pin = malloc(sizeof(*pin), M_DEVBUF, M_NOWAIT | M_ZERO); if (pin != NULL) { - bzero(pin, sizeof *pin); pin->pin_dot1x_auth = PIN_DOT1X_UNAUTHORIZED; } return (struct ieee80211_node *)pin; @@ -2284,8 +2283,7 @@ pgt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t req) case SIOCG80211ALLNODES: { struct ieee80211_nodereq *nr = NULL; na = (struct ieee80211_nodereq_all *)req; - wreq = malloc(sizeof(*wreq), M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof(*wreq), M_DEVBUF, M_WAITOK | M_ZERO); maxscan = PGT_OBJ_BSSLIST_NBSS; pob = malloc(sizeof(*pob) + -- cgit v1.2.3