From a854e6884a9635329a1490f5cf8420c8ab6f8f85 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 17 Sep 2007 01:33:34 +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/arch/mac68k/dev/grf_iv.c | 5 ++--- sys/arch/mac68k/dev/grf_mv.c | 5 ++--- sys/arch/macppc/dev/awacs.c | 5 ++--- sys/arch/macppc/dev/dbdma.c | 5 ++--- sys/arch/macppc/dev/i2s.c | 5 ++--- sys/arch/sparc64/dev/central.c | 5 ++--- sys/arch/sparc64/dev/ebus_mainbus.c | 5 ++--- sys/arch/sparc64/dev/fhc.c | 5 ++--- sys/arch/sparc64/dev/sbus.c | 5 ++--- sys/arch/sparc64/dev/upa.c | 5 ++--- sys/arch/sparc64/sparc64/intr.c | 5 ++--- sys/arch/vax/if/if_qe.c | 5 ++--- sys/arch/zaurus/dev/zaurus_kbd.c | 8 +++----- sys/dev/ic/if_wi.c | 41 ++++++++++++++----------------------- sys/dev/ic/rtw.c | 6 ++---- sys/dev/pci/agp.c | 8 +++----- sys/dev/pci/agp_i810.c | 5 ++--- sys/dev/pci/if_san_xilinx.c | 5 ++--- sys/dev/pci/ips.c | 5 ++--- sys/dev/sdmmc/sdmmc_io.c | 5 ++--- sys/dev/wscons/wsmux.c | 5 ++--- sys/dev/wsfont/wsfont.c | 6 ++---- sys/isofs/udf/udf_vnops.c | 5 ++--- sys/msdosfs/msdosfs_vfsops.c | 5 ++--- sys/netbt/hci_link.c | 5 ++--- sys/netbt/hci_socket.c | 5 ++--- sys/netbt/rfcomm_session.c | 5 ++--- sys/ntfs/ntfs_vfsops.c | 5 ++--- 28 files changed, 71 insertions(+), 113 deletions(-) diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c index 6ac8c2186db..08d12e94521 100644 --- a/sys/arch/mac68k/dev/grf_iv.c +++ b/sys/arch/mac68k/dev/grf_iv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_iv.c,v 1.41 2006/03/13 22:35:17 miod Exp $ */ +/* $OpenBSD: grf_iv.c,v 1.42 2007/09/17 01:33:32 krw Exp $ */ /* $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $ */ /* @@ -175,8 +175,7 @@ macfb_obio_attach(struct device *parent, struct device *self, void *aux) sc->card_id = 0; sc->sc_tag = oa->oa_tag; - dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK); - bzero(dc, sizeof(*dc)); + dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK | M_ZERO); switch (current_mac_model->class) { case MACH_CLASSQ2: diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 1952836e6f3..19d3231ba3f 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_mv.c,v 1.34 2007/09/10 20:29:46 miod Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.35 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */ /* @@ -195,8 +195,7 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux) load_image_data((caddr_t)&image_store, &image); - dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK); - bzero(dc, sizeof(*dc)); + dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK | M_ZERO); dc->dc_vaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle); dc->dc_paddr = sc->sc_basepa; diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c index c7eafabb261..380b4a79e9e 100644 --- a/sys/arch/macppc/dev/awacs.c +++ b/sys/arch/macppc/dev/awacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awacs.c,v 1.19 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: awacs.c,v 1.20 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */ /*- @@ -990,10 +990,9 @@ awacs_allocm(void *h, int dir, size_t size, int type, int flags) if (size > AWACS_DMALIST_MAX * AWACS_DMASEG_MAX) return (NULL); - p = malloc(sizeof(*p), type, flags); + p = malloc(sizeof(*p), type, flags | M_ZERO); if (!p) return (NULL); - bzero(p, sizeof(*p)); /* convert to the bus.h style, not used otherwise */ if (flags & M_NOWAIT) diff --git a/sys/arch/macppc/dev/dbdma.c b/sys/arch/macppc/dev/dbdma.c index d6622654072..904d4049a58 100644 --- a/sys/arch/macppc/dev/dbdma.c +++ b/sys/arch/macppc/dev/dbdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbdma.c,v 1.8 2006/01/13 19:25:44 miod Exp $ */ +/* $OpenBSD: dbdma.c,v 1.9 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: dbdma.c,v 1.2 1998/08/21 16:13:28 tsubai Exp $ */ /* @@ -119,10 +119,9 @@ dbdma_alloc(bus_dma_tag_t dmat, int size) dbdma_t dt; int error; - dt = malloc(sizeof *dt, M_DEVBUF, M_NOWAIT); + dt = malloc(sizeof *dt, M_DEVBUF, M_NOWAIT | M_ZERO); if (!dt) return (dt); - bzero(dt, sizeof *dt); dt->d_size = size *= sizeof(dbdma_command_t); dt->d_dmat = dmat; diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c index a4942db7abd..c82529f87fe 100644 --- a/sys/arch/macppc/dev/i2s.c +++ b/sys/arch/macppc/dev/i2s.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2s.c,v 1.8 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: i2s.c,v 1.9 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -1188,10 +1188,9 @@ i2s_allocm(void *h, int dir, size_t size, int type, int flags) if (size > I2S_DMALIST_MAX * I2S_DMASEG_MAX) return (NULL); - p = malloc(sizeof(*p), type, flags); + p = malloc(sizeof(*p), type, flags | M_ZERO); if (!p) return (NULL); - bzero(p, sizeof(*p)); /* convert to the bus.h style, not used otherwise */ if (flags & M_NOWAIT) diff --git a/sys/arch/sparc64/dev/central.c b/sys/arch/sparc64/dev/central.c index 896d578b010..dda9441a651 100644 --- a/sys/arch/sparc64/dev/central.c +++ b/sys/arch/sparc64/dev/central.c @@ -1,4 +1,4 @@ -/* $OpenBSD: central.c,v 1.4 2004/09/27 17:28:03 jason Exp $ */ +/* $OpenBSD: central.c,v 1.5 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -150,11 +150,10 @@ central_alloc_bus_tag(struct central_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("central: couldn't alloc bus tag"); - bzero(bt, sizeof(*bt)); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dv.dv_xname); bt->cookie = sc; bt->parent = sc->sc_bt; diff --git a/sys/arch/sparc64/dev/ebus_mainbus.c b/sys/arch/sparc64/dev/ebus_mainbus.c index 2e1f0260474..5e14adb4a98 100644 --- a/sys/arch/sparc64/dev/ebus_mainbus.c +++ b/sys/arch/sparc64/dev/ebus_mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ebus_mainbus.c,v 1.3 2007/04/07 20:15:54 kettenis Exp $ */ +/* $OpenBSD: ebus_mainbus.c,v 1.4 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2007 Mark Kettenis @@ -169,11 +169,10 @@ ebus_alloc_bus_tag(struct ebus_softc *sc, bus_space_tag_t parent) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("could not allocate ebus bus tag"); - bzero(bt, sizeof *bt); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dev.dv_xname); bt->cookie = sc; bt->parent = parent; diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 064d3990818..75c9822ccbb 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc.c,v 1.13 2007/05/01 19:44:56 kettenis Exp $ */ +/* $OpenBSD: fhc.c,v 1.14 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -167,11 +167,10 @@ fhc_alloc_bus_tag(struct fhc_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("fhc: couldn't alloc bus tag"); - bzero(bt, sizeof(*bt)); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dv.dv_xname); bt->cookie = sc; bt->parent = sc->sc_bt; diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 8a77debba3b..242fa0be227 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.27 2007/05/29 09:54:13 sobrado Exp $ */ +/* $OpenBSD: sbus.c,v 1.28 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -772,11 +772,10 @@ sbus_alloc_bustag(struct sbus_softc *sc, int indirect) { struct sparc_bus_space_tag *sbt; - sbt = malloc(sizeof(*sbt), M_DEVBUF, M_NOWAIT); + sbt = malloc(sizeof(*sbt), M_DEVBUF, M_NOWAIT | M_ZERO); if (sbt == NULL) return (NULL); - bzero(sbt, sizeof *sbt); snprintf(sbt->name, sizeof(sbt->name), "%s", sc->sc_dev.dv_xname); sbt->cookie = sc; diff --git a/sys/arch/sparc64/dev/upa.c b/sys/arch/sparc64/dev/upa.c index 8b55ea4dfb4..323bdfaf68e 100644 --- a/sys/arch/sparc64/dev/upa.c +++ b/sys/arch/sparc64/dev/upa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upa.c,v 1.5 2007/03/05 18:58:30 kettenis Exp $ */ +/* $OpenBSD: upa.c,v 1.6 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -163,11 +163,10 @@ upa_alloc_bus_tag(struct upa_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("upa: couldn't alloc bus tag"); - bzero(bt, sizeof *bt); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dev.dv_xname); bt->cookie = sc; diff --git a/sys/arch/sparc64/sparc64/intr.c b/sys/arch/sparc64/sparc64/intr.c index e9c424d1f2f..e488b25708e 100644 --- a/sys/arch/sparc64/sparc64/intr.c +++ b/sys/arch/sparc64/sparc64/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.27 2007/09/09 08:55:27 kettenis Exp $ */ +/* $OpenBSD: intr.c,v 1.28 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */ /* @@ -308,8 +308,7 @@ softintr_establish(level, fun, arg) { struct intrhand *ih; - ih = malloc(sizeof(*ih), M_DEVBUF, 0); - bzero(ih, sizeof(*ih)); + ih = malloc(sizeof(*ih), M_DEVBUF, M_ZERO); ih->ih_fun = (int (*)(void *))fun; /* XXX */ ih->ih_arg = arg; ih->ih_pil = level; diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index dc9027a8c15..24dce6176a5 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.20 2006/04/16 00:46:32 pascoe Exp $ */ +/* $OpenBSD: if_qe.c,v 1.21 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -143,9 +143,8 @@ qematch(struct device *parent, struct cfdata *cf, void *aux) struct qe_ring *rp; int error; - ring = malloc(PROBESIZE, M_TEMP, M_WAITOK); + ring = malloc(PROBESIZE, M_TEMP, M_WAITOK | M_ZERO); bzero(sc, sizeof(struct qe_softc)); - bzero(ring, PROBESIZE); sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; sc->sc_dmat = ua->ua_dmat; diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c index 594055ba5c1..689e764da0c 100644 --- a/sys/arch/zaurus/dev/zaurus_kbd.c +++ b/sys/arch/zaurus/dev/zaurus_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */ +/* $OpenBSD: zaurus_kbd.c,v 1.29 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -204,12 +204,10 @@ zkbd_attach(struct device *parent, struct device *self, void *aux) } /* XXX */ sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - bzero(sc->sc_okeystate, (sc->sc_nsense * sc->sc_nstrobe)); + M_DEVBUF, M_NOWAIT | M_ZERO); sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - bzero(sc->sc_keystate, (sc->sc_nsense * sc->sc_nstrobe)); + M_DEVBUF, M_NOWAIT | M_ZERO); /* set all the strobe bits */ for (i = 0; i < sc->sc_nstrobe; i++) { diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 8de7abf4a19..30520bfb12e 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.137 2006/11/26 19:46:28 deraadt Exp $ */ +/* $OpenBSD: if_wi.c,v 1.138 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -126,7 +126,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.137 2006/11/26 19:46:28 deraadt Exp $"; + "$OpenBSD: if_wi.c,v 1.138 2007/09/17 01:33:33 krw Exp $"; #endif /* lint */ #ifdef foo @@ -1644,8 +1644,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, command); break; case SIOCGWAVELAN: - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); if (error) break; @@ -1702,8 +1701,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSWAVELAN: if ((error = suser(curproc, 0)) != 0) break; - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); if (error) break; @@ -1770,8 +1768,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCGPRISM2DEBUG: - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); if (error) break; @@ -1787,8 +1784,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSPRISM2DEBUG: if ((error = suser(curproc, 0)) != 0) break; - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); if (error) break; @@ -1800,16 +1796,15 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = copyout(&sc->wi_net_name, ifr->ifr_data, sizeof(sc->wi_net_name)); } else { - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK|M_ZERO); wreq->wi_type = WI_RID_CURRENT_SSID; wreq->wi_len = WI_MAX_DATALEN; if (wi_read_record(sc, (struct wi_ltv_gen *)wreq) || letoh16(wreq->wi_val[0]) > IEEE80211_NWID_LEN) error = EINVAL; else { - nwidp = malloc(sizeof *nwidp, M_DEVBUF, M_WAITOK); - bzero(nwidp, sizeof(*nwidp)); + nwidp = malloc(sizeof *nwidp, M_DEVBUF, + M_WAITOK | M_ZERO); wi_set_ssid(nwidp, (u_int8_t *)&wreq->wi_val[1], letoh16(wreq->wi_val[0])); error = copyout(nwidp, ifr->ifr_data, @@ -1868,8 +1863,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = EINVAL; break; } - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); wreq->wi_type = WI_RID_OWN_CHNL; wreq->wi_val[0] = htole16(((struct ieee80211chanreq *)data)->i_channel); @@ -1878,8 +1872,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) wi_init(sc); break; case SIOCG80211CHANNEL: - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); wreq->wi_type = WI_RID_CURRENT_CHAN; wreq->wi_len = WI_MAX_DATALEN; if (wi_read_record(sc, (struct wi_ltv_gen *)wreq)) { @@ -1891,8 +1884,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCG80211BSSID: bssid = (struct ieee80211_bssid *)data; - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); wreq->wi_type = WI_RID_CURRENT_BSSID; wreq->wi_len = WI_MAX_DATALEN; if (wi_read_record(sc, (struct wi_ltv_gen *)wreq)) { @@ -1914,8 +1906,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_SCAN_RESULTS, 0, 0); } else { - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK|M_ZERO); wreq->wi_len = 3; wreq->wi_type = WI_RID_SCAN_REQ; wreq->wi_val[0] = 0x3FFF; @@ -1951,8 +1942,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = wihap_ioctl(sc, command, data); break; } - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); wreq->wi_len = WI_MAX_DATALEN; wreq->wi_type = WI_RID_SCAN_RES; if (sc->sc_firmware_type == WI_LUCENT) { @@ -2026,8 +2016,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; ifr->ifr_flags = 0; if (sc->wi_flags & WI_FLAGS_HAS_ENH_SECURITY) { - wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK); - bzero(wreq, sizeof(*wreq)); + wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK|M_ZERO); wreq->wi_len = WI_MAX_DATALEN; wreq->wi_type = WI_RID_ENH_SECURITY; if (wi_read_record(sc, (struct wi_ltv_gen *)wreq)) { diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 50dafe4da42..43e2f99412b 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.61 2007/06/07 20:20:15 damien Exp $ */ +/* $OpenBSD: rtw.c,v 1.62 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -664,15 +664,13 @@ rtw_srom_read(struct rtw_regs *regs, u_int32_t flags, struct rtw_srom *sr, RTW_WRITE8(regs, RTW_9346CR, ecr); - sr->sr_content = malloc(sr->sr_size, M_DEVBUF, M_NOWAIT); + sr->sr_content = malloc(sr->sr_size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sr->sr_content == NULL) { printf("%s: unable to allocate SROM buffer\n", dvname); return ENOMEM; } - bzero(sr->sr_content, sr->sr_size); - /* RTL8180 has a single 8-bit register for controlling the * 93cx6 SROM. There is no "ready" bit. The RTL8180 * input/output sense is the reverse of read_seeprom's. diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 20147866804..52faa49e477 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.6 2007/08/04 19:40:25 reyk Exp $ */ +/* $OpenBSD: agp.c,v 1.7 2007/09/17 01:33:33 krw Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -372,10 +372,9 @@ agp_alloc_gatt(struct vga_pci_softc *sc) struct agp_gatt *gatt; int nseg; - gatt = malloc(sizeof(*gatt), M_DEVBUF, M_NOWAIT); + gatt = malloc(sizeof(*gatt), M_DEVBUF, M_NOWAIT | M_ZERO); if (!gatt) return (NULL); - bzero(gatt, sizeof(*gatt)); gatt->ag_entries = entries; if (agp_alloc_dmamem(sc->sc_dmat, entries * sizeof(u_int32_t), @@ -474,10 +473,9 @@ agp_generic_alloc_memory(struct vga_pci_softc *sc, int type, vsize_t size) return 0; } - mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK); + mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK | M_ZERO); if (mem == NULL) return NULL; - bzero(mem, sizeof *mem); if (bus_dmamap_create(sc->sc_dmat, size, size / PAGE_SIZE + 1, size, 0, BUS_DMA_NOWAIT, &mem->am_dmamap) != 0) { diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c index 916873b5a8c..d405e3d4e89 100644 --- a/sys/dev/pci/agp_i810.c +++ b/sys/dev/pci/agp_i810.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_i810.c,v 1.15 2007/08/04 19:40:25 reyk Exp $ */ +/* $OpenBSD: agp_i810.c,v 1.16 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: agp_i810.c,v 1.15 2003/01/31 00:07:39 thorpej Exp $ */ /*- @@ -680,8 +680,7 @@ agp_i810_alloc_memory(struct vga_pci_softc *sc, int type, vsize_t size) } } - mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK); - bzero(mem, sizeof *mem); + mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK | M_ZERO); mem->am_id = sc->sc_nextid++; mem->am_size = size; mem->am_type = type; diff --git a/sys/dev/pci/if_san_xilinx.c b/sys/dev/pci/if_san_xilinx.c index 7c85bf0f1ed..dbcd6b91a13 100644 --- a/sys/dev/pci/if_san_xilinx.c +++ b/sys/dev/pci/if_san_xilinx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_xilinx.c,v 1.19 2007/09/12 13:56:40 chl Exp $ */ +/* $OpenBSD: if_san_xilinx.c,v 1.20 2007/09/17 01:33:33 krw Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -2390,11 +2390,10 @@ aft_alloc_rx_buffers(xilinx_softc_t *sc) SIMPLEQ_INIT(&sc->wp_rx_complete_list); /* allocate receive buffers in one cluster */ - buf = malloc(sizeof(*buf) * MAX_RX_BUF, M_DEVBUF, M_NOWAIT); + buf = malloc(sizeof(*buf) * MAX_RX_BUF, M_DEVBUF, M_NOWAIT | M_ZERO); if (buf == NULL) return (1); - bzero(buf, sizeof(*buf) * MAX_RX_BUF); sc->wp_rx_buffers = buf; sc->wp_rx_buffer_last = buf; diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index 97785355ab5..db873c0c345 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.29 2007/06/06 20:51:13 grange Exp $ */ +/* $OpenBSD: ips.c,v 1.30 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2006, 2007 Alexander Yurchenko @@ -951,9 +951,8 @@ ips_ccb_alloc(struct ips_softc *sc, int n) struct ips_ccb *ccb; int i; - if ((ccb = malloc(n * sizeof(*ccb), M_DEVBUF, M_NOWAIT)) == NULL) + if ((ccb = malloc(n * sizeof(*ccb), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) return (NULL); - bzero(ccb, n * sizeof(*ccb)); for (i = 0; i < n; i++) { ccb[i].c_id = i; diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c index 07d0cea898f..839740ee8be 100644 --- a/sys/dev/sdmmc/sdmmc_io.c +++ b/sys/dev/sdmmc/sdmmc_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_io.c,v 1.9 2007/06/02 01:48:37 uwe Exp $ */ +/* $OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler @@ -611,11 +611,10 @@ sdmmc_intr_establish(struct device *sdmmc, int (*fun)(void *), if (sc->sct->card_intr_mask == NULL) return NULL; - ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK | M_CANFAIL); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK | M_CANFAIL | M_ZERO); if (ih == NULL) return NULL; - bzero(ih, sizeof *ih); ih->ih_name = malloc(strlen(name), M_DEVBUF, M_WAITOK | M_CANFAIL); if (ih->ih_name == NULL) { free(ih, M_DEVBUF); diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index 59576f16c67..d112081b4cb 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmux.c,v 1.20 2007/05/14 09:03:34 tedu Exp $ */ +/* $OpenBSD: wsmux.c,v 1.21 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */ /* @@ -589,10 +589,9 @@ wsmux_create(const char *name, int unit) struct wsmux_softc *sc; DPRINTF(("wsmux_create: allocating\n")); - sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT); + sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) return (NULL); - bzero(sc, sizeof *sc); CIRCLEQ_INIT(&sc->sc_cld); snprintf(sc->sc_base.me_dv.dv_xname, sizeof sc->sc_base.me_dv.dv_xname, "%s%d", name, unit); diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c index 2bd7287a5ad..8b438310961 100644 --- a/sys/dev/wsfont/wsfont.c +++ b/sys/dev/wsfont/wsfont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsfont.c,v 1.21 2007/09/10 19:49:31 gilles Exp $ */ +/* $OpenBSD: wsfont.c,v 1.22 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: wsfont.c,v 1.17 2001/02/07 13:59:24 ad Exp $ */ /*- @@ -313,14 +313,12 @@ wsfont_rotate_internal(struct wsdisplay_font *font) /* Allocate a buffer big enough for the rotated font. */ newstride = (font->fontheight + 7) / 8; newbits = malloc(newstride * font->fontwidth * font->numchars, - M_DEVBUF, M_WAITOK); + M_DEVBUF, M_WAITOK | M_ZERO); if (newbits == NULL) { free(newfont, M_DEVBUF); return (NULL); } - bzero(newbits, newstride * font->fontwidth * font->numchars); - /* Rotate the font a bit at a time. */ for (n = 0; n < font->numchars; n++) { char *ch = font->data + (n * font->stride * font->fontheight); diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c index fc2a2c831ef..2a557d8385d 100644 --- a/sys/isofs/udf/udf_vnops.c +++ b/sys/isofs/udf/udf_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vnops.c,v 1.27 2007/06/06 17:15:13 deraadt Exp $ */ +/* $OpenBSD: udf_vnops.c,v 1.28 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long @@ -617,8 +617,7 @@ udf_getfid(struct udf_dirstream *ds) * File ID descriptors can only be at most one * logical sector in size. */ - ds->buf = malloc(ds->ump->um_bsize, M_UDFFID, M_WAITOK); - bzero(ds->buf, ds->ump->um_bsize); + ds->buf = malloc(ds->ump->um_bsize, M_UDFFID, M_WAITOK|M_ZERO); bcopy(fid, ds->buf, frag_size); /* Reduce all of the casting magic */ diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index f99123197c5..d2cf826f2c3 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.47 2007/03/21 17:29:32 thib Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.48 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -302,8 +302,7 @@ msdosfs_mountfs(devvp, mp, p, argp) b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB; b710 = (struct byte_bpb710 *)bsp->bs710.bsPBP; - pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK); - bzero((caddr_t)pmp, sizeof *pmp); + pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK | M_ZERO); pmp->pm_mountp = mp; /* diff --git a/sys/netbt/hci_link.c b/sys/netbt/hci_link.c index 0de5ec40a60..65efaf2f120 100644 --- a/sys/netbt/hci_link.c +++ b/sys/netbt/hci_link.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hci_link.c,v 1.5 2007/07/22 21:05:00 gwk Exp $ */ +/* $OpenBSD: hci_link.c,v 1.6 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: hci_link.c,v 1.11 2007/04/21 06:15:23 plunky Exp $ */ /*- @@ -888,10 +888,9 @@ hci_link_alloc(struct hci_unit *unit) KASSERT(unit != NULL); - link = malloc(sizeof *link, M_BLUETOOTH, M_NOWAIT); + link = malloc(sizeof *link, M_BLUETOOTH, M_NOWAIT | M_ZERO); if (link == NULL) return NULL; - bzero(link, sizeof *link); link->hl_unit = unit; link->hl_state = HCI_LINK_CLOSED; diff --git a/sys/netbt/hci_socket.c b/sys/netbt/hci_socket.c index 1d55814ad22..4933e461aa0 100644 --- a/sys/netbt/hci_socket.c +++ b/sys/netbt/hci_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hci_socket.c,v 1.3 2007/06/02 01:46:01 uwe Exp $ */ +/* $OpenBSD: hci_socket.c,v 1.4 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: hci_socket.c,v 1.10 2007/03/31 18:17:13 plunky Exp $ */ /*- @@ -350,10 +350,9 @@ hci_usrreq(struct socket *up, int req, struct mbuf *m, if (err) return err; - pcb = malloc(sizeof *pcb, M_PCB, M_NOWAIT); + pcb = malloc(sizeof *pcb, M_PCB, M_NOWAIT | M_ZERO); if (pcb == NULL) return ENOMEM; - bzero(pcb, sizeof *pcb); up->so_pcb = pcb; pcb->hp_socket = up; diff --git a/sys/netbt/rfcomm_session.c b/sys/netbt/rfcomm_session.c index f1d88643f54..0852c9f0996 100644 --- a/sys/netbt/rfcomm_session.c +++ b/sys/netbt/rfcomm_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfcomm_session.c,v 1.1 2007/06/01 02:46:12 uwe Exp $ */ +/* $OpenBSD: rfcomm_session.c,v 1.2 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: rfcomm_session.c,v 1.9 2007/04/21 06:15:23 plunky Exp $ */ /*- @@ -174,10 +174,9 @@ rfcomm_session_alloc(struct rfcomm_session_list *list, struct rfcomm_session *rs; int err; - rs = malloc(sizeof(*rs), M_BLUETOOTH, M_NOWAIT); + rs = malloc(sizeof(*rs), M_BLUETOOTH, M_NOWAIT | M_ZERO); if (rs == NULL) return NULL; - bzero(rs, sizeof *rs); rs->rs_state = RFCOMM_SESSION_CLOSED; diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index 9d58b930290..c965aaedb00 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vfsops.c,v 1.11 2006/04/19 11:55:55 pedro Exp $ */ +/* $OpenBSD: ntfs_vfsops.c,v 1.12 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -543,8 +543,7 @@ ntfs_mountfs(devvp, mp, argsp, p) error = bread(devvp, BBLOCK, BBSIZE, NOCRED, &bp); if (error) goto out; - ntmp = malloc(sizeof *ntmp, M_NTFSMNT, M_WAITOK); - bzero(ntmp, sizeof *ntmp); + ntmp = malloc(sizeof *ntmp, M_NTFSMNT, M_WAITOK | M_ZERO); bcopy(bp->b_data, &ntmp->ntm_bootfile, sizeof(struct bootfile)); brelse(bp); bp = NULL; -- cgit v1.2.3