From dcf705893e85be5a07a3dc7f028ec7e530b19050 Mon Sep 17 00:00:00 2001 From: cegger Date: Fri, 19 Dec 2008 18:49:37 +0000 Subject: [PATCH] use M_ZERO on malloc() and remove subsequent bzero(). --- sys/arch/acorn26/acorn26/mem.c | 9 ++++----- sys/arch/amiga/amiga/mem.c | 14 ++++++-------- sys/arch/amiga/amiga/pmap.c | 7 +++---- sys/arch/amiga/dev/amidisplaycc.c | 7 +++---- sys/arch/atari/atari/mainbus.c | 10 +++++----- sys/arch/atari/atari/mem.c | 9 ++++----- sys/arch/atari/atari/pmap.c | 7 +++---- sys/arch/cesfic/cesfic/mem.c | 7 +++---- sys/arch/luna68k/luna68k/mem.c | 9 ++++----- sys/arch/mac68k/mac68k/mem.c | 9 ++++----- sys/arch/sparc/dev/vme_machdep.c | 8 +++----- sys/arch/sparc/sparc/cpu.c | 8 ++++---- sys/arch/sparc/sparc/mem.c | 9 ++++----- sys/arch/vax/vax/mem.c | 7 +++---- sys/arch/vax/vsa/smg.c | 7 +++---- sys/dev/ic/hd44780_subr.c | 8 ++++---- sys/dev/pci/cxgb_sge.c | 8 +++----- sys/dev/pci/ubsec.c | 7 +++---- sys/dist/pf/net/if_pflog.c | 7 +++---- sys/dist/pf/net/pf_if.c | 7 +++---- sys/fs/ntfs/ntfs_vfsops.c | 7 +++---- sys/fs/udf/udf_subr.c | 10 ++++------ sys/netinet/ip_carp.c | 7 +++---- sys/netinet/ip_mroute.c | 7 +++---- sys/netinet6/ah_aesxcbcmac.c | 7 +++---- sys/netinet6/in6.c | 18 +++++++----------- sys/netinet6/nd6_rtr.c | 10 ++++------ sys/netiso/tp_subr.c | 7 +++---- sys/netsmb/smb_crypt.c | 7 +++---- 29 files changed, 105 insertions(+), 139 deletions(-) diff --git a/sys/arch/acorn26/acorn26/mem.c b/sys/arch/acorn26/acorn26/mem.c index 0ef542cffd47..922fcc0a48d8 100644 --- a/sys/arch/acorn26/acorn26/mem.c +++ b/sys/arch/acorn26/acorn26/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.12 2008/12/15 09:43:27 he Exp $ */ +/* $NetBSD: mem.c,v 1.13 2008/12/19 18:49:37 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.12 2008/12/15 09:43:27 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.13 2008/12/19 18:49:37 cegger Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -175,9 +175,8 @@ mmrw(dev, uio, flags) return (0); } if (zeropage == NULL) { - zeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(zeropage, PAGE_SIZE); + zeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); diff --git a/sys/arch/amiga/amiga/mem.c b/sys/arch/amiga/amiga/mem.c index 7728ae830e8d..2a2853d76a90 100644 --- a/sys/arch/amiga/amiga/mem.c +++ b/sys/arch/amiga/amiga/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.42 2007/03/05 20:30:09 he Exp $ */ +/* $NetBSD: mem.c,v 1.43 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.42 2007/03/05 20:30:09 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.43 2008/12/19 18:49:38 cegger Exp $"); /* * Memory special file @@ -185,10 +185,9 @@ mmrw(dev, uio, flags) */ if (uio->uio_rw == UIO_READ) { if (devzeropage == NULL) { - devzeropage = (void *) + devzeropage = malloc(PAGE_SIZE, M_TEMP, - M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + M_WAITOK|M_ZERO); } c = min(c, PAGE_SIZE - (int)v); v = (vm_offset_t) devzeropage; @@ -215,9 +214,8 @@ mmrw(dev, uio, flags) break; } if (devzeropage == NULL) { - devzeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + devzeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index 60ac955e6a85..3a1ab21feaa8 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.138 2008/12/10 11:10:18 pooka Exp $ */ +/* $NetBSD: pmap.c,v 1.139 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -100,7 +100,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.138 2008/12/10 11:10:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.139 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -668,8 +668,7 @@ pmap_create() printf("pmap_create\n"); #endif - pmap = malloc(sizeof *pmap, M_VMPMAP, M_WAITOK); - bzero(pmap, sizeof(*pmap)); + pmap = malloc(sizeof *pmap, M_VMPMAP, M_WAITOK|M_ZERO); pmap_pinit(pmap); return (pmap); } diff --git a/sys/arch/amiga/dev/amidisplaycc.c b/sys/arch/amiga/dev/amidisplaycc.c index 43433163ceb6..ed4299b72e2c 100644 --- a/sys/arch/amiga/dev/amidisplaycc.c +++ b/sys/arch/amiga/dev/amidisplaycc.c @@ -1,4 +1,4 @@ -/* $NetBSD: amidisplaycc.c,v 1.20 2007/03/04 05:59:16 christos Exp $ */ +/* $NetBSD: amidisplaycc.c,v 1.21 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 2000 Jukka Andberg. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.20 2007/03/04 05:59:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.21 2008/12/19 18:49:38 cegger Exp $"); /* * wscons interface to amiga custom chips. Contains the necessary functions @@ -1263,8 +1263,7 @@ amidisplaycc_alloc_screen(void *dp, const struct wsscreen_descr *screenp, scr->isconsole = 1; } else { - scr = malloc(sizeof(adccscr_t), M_DEVBUF, M_WAITOK); - bzero(scr, sizeof(adccscr_t)); + scr = malloc(sizeof(adccscr_t), M_DEVBUF, M_WAITOK|M_ZERO); } scr->view = view; diff --git a/sys/arch/atari/atari/mainbus.c b/sys/arch/atari/atari/mainbus.c index 8f79bdf99873..1f9f383385d8 100644 --- a/sys/arch/atari/atari/mainbus.c +++ b/sys/arch/atari/atari/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.6 2008/04/28 20:23:15 martin Exp $ */ +/* $NetBSD: mainbus.c,v 1.7 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.6 2008/04/28 20:23:15 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -168,9 +168,9 @@ mb_alloc_bus_space_tag() bus_space_tag_t mb_t; /* Not really M_TEMP, is it.. */ - if ((mb_t = malloc(sizeof(*mb_t), M_TEMP, M_NOWAIT)) == NULL) - return(NULL); - bzero(mb_t, sizeof(*mb_t)); + mb_t = malloc(sizeof(*mb_t), M_TEMP, M_NOWAIT|M_ZERO); + if (mb_t == NULL) + return NULL; mb_t->abs_p_1 = mb_bus_space_peek_1; mb_t->abs_p_2 = mb_bus_space_peek_2; diff --git a/sys/arch/atari/atari/mem.c b/sys/arch/atari/atari/mem.c index bf9456c90016..341ae52a9e81 100644 --- a/sys/arch/atari/atari/mem.c +++ b/sys/arch/atari/atari/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.33 2007/03/06 13:53:32 tsutsui Exp $ */ +/* $NetBSD: mem.c,v 1.34 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.33 2007/03/06 13:53:32 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.34 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -200,9 +200,8 @@ mmrw(dev, uio, flags) break; } if (devzeropage == NULL) { - devzeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + devzeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); diff --git a/sys/arch/atari/atari/pmap.c b/sys/arch/atari/atari/pmap.c index 6e119f3af3b8..b123ddfe99a8 100644 --- a/sys/arch/atari/atari/pmap.c +++ b/sys/arch/atari/atari/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.108 2008/12/10 11:10:18 pooka Exp $ */ +/* $NetBSD: pmap.c,v 1.109 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -100,7 +100,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2008/12/10 11:10:18 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -747,8 +747,7 @@ pmap_create() printf("pmap_create\n"); #endif - pmap = malloc(sizeof *pmap, M_VMPMAP, M_WAITOK); - bzero(pmap, sizeof(*pmap)); + pmap = malloc(sizeof(*pmap), M_VMPMAP, M_WAITOK|M_ZERO); pmap_pinit(pmap); return (pmap); } diff --git a/sys/arch/cesfic/cesfic/mem.c b/sys/arch/cesfic/cesfic/mem.c index 0393fd82a67d..2287d026624a 100644 --- a/sys/arch/cesfic/cesfic/mem.c +++ b/sys/arch/cesfic/cesfic/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.11 2007/03/05 12:30:37 tsutsui Exp $ */ +/* $NetBSD: mem.c,v 1.12 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.11 2007/03/05 12:30:37 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.12 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -200,8 +200,7 @@ mmrw(dev, uio, flags) */ if (devzeropage == NULL) { devzeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); diff --git a/sys/arch/luna68k/luna68k/mem.c b/sys/arch/luna68k/luna68k/mem.c index e6d1465e2af8..894ecf822fee 100644 --- a/sys/arch/luna68k/luna68k/mem.c +++ b/sys/arch/luna68k/luna68k/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.13 2007/03/04 12:49:10 tsutsui Exp $ */ +/* $NetBSD: mem.c,v 1.14 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -74,7 +74,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.13 2007/03/04 12:49:10 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.14 2008/12/19 18:49:38 cegger Exp $"); /* * Memory special file @@ -186,9 +186,8 @@ mmrw(dev, uio, flags) * of memory for use with /dev/zero. */ if (devzeropage == NULL) { - devzeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + devzeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); diff --git a/sys/arch/mac68k/mac68k/mem.c b/sys/arch/mac68k/mac68k/mem.c index 89932e3bbc93..7fa26a7a8ba0 100644 --- a/sys/arch/mac68k/mac68k/mem.c +++ b/sys/arch/mac68k/mac68k/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.39 2007/03/05 12:30:38 tsutsui Exp $ */ +/* $NetBSD: mem.c,v 1.40 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.39 2007/03/05 12:30:38 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.40 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -184,9 +184,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) * of memory for use with /dev/zero. */ if (devzeropage == NULL) { - devzeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, PAGE_SIZE); + devzeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); diff --git a/sys/arch/sparc/dev/vme_machdep.c b/sys/arch/sparc/dev/vme_machdep.c index 696873e5a5b0..9b9014da3f07 100644 --- a/sys/arch/sparc/dev/vme_machdep.c +++ b/sys/arch/sparc/dev/vme_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.58 2008/12/16 22:35:26 christos Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.59 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.58 2008/12/16 22:35:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.59 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -766,11 +766,9 @@ sparc_vme_intr_establish(void *cookie, vme_intr_handle_t vih, int level, break; if (ih == NULL) { - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); + ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT|M_ZERO); if (ih == NULL) panic("vme_addirq"); - bzero(ih, sizeof *ih); ih->ih_fun = sc->sc_vmeintr; ih->ih_arg = vih; intr_establish(pil, 0, ih, NULL); diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c index dffac7941dc5..1d3e25c11c80 100644 --- a/sys/arch/sparc/sparc/cpu.c +++ b/sys/arch/sparc/sparc/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.211 2008/06/04 12:41:41 ad Exp $ */ +/* $NetBSD: cpu.c,v 1.212 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1996 @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.211 2008/06/04 12:41:41 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.212 2008/12/19 18:49:38 cegger Exp $"); #include "opt_multiprocessor.h" #include "opt_lockdebug.h" @@ -411,8 +411,8 @@ cpu_attach(struct cpu_softc *sc, int node, int mid) * (see autoconf.c and cpuunit.c) */ if (cpus == NULL) { - cpus = malloc(sparc_ncpus * sizeof(cpi), M_DEVBUF, M_NOWAIT); - bzero(cpus, sparc_ncpus * sizeof(cpi)); + cpus = malloc(sparc_ncpus * sizeof(cpi), + M_DEVBUF, M_NOWAIT|M_ZERO); getcpuinfo(&cpuinfo, node); diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index b86c22c66653..a7710f9a5337 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.40 2007/03/04 09:23:29 macallan Exp $ */ +/* $NetBSD: mem.c,v 1.41 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.40 2007/03/04 09:23:29 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.41 2008/12/19 18:49:38 cegger Exp $"); #include "opt_sparc_arch.h" @@ -205,9 +205,8 @@ mmrw(dev_t dev, struct uio *uio, int flags) return(0); } if (zeropage == NULL) { - zeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(zeropage, PAGE_SIZE); + zeropage = + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c index f0aca43e48eb..d041a45df10b 100644 --- a/sys/arch/vax/vax/mem.c +++ b/sys/arch/vax/vax/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.37 2008/03/11 05:34:03 matt Exp $ */ +/* $NetBSD: mem.c,v 1.38 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.37 2008/03/11 05:34:03 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.38 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -158,8 +158,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } if (zeropage == NULL) { zeropage = (void *) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(zeropage, PAGE_SIZE); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); } c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index f87d9348ab64..a5e8273a9d10 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $NetBSD: smg.c,v 1.48 2008/03/15 00:21:30 matt Exp $ */ +/* $NetBSD: smg.c,v 1.49 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.48 2008/03/15 00:21:30 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.49 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -536,8 +536,7 @@ int smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, int *curxp, int *curyp, long *defattrp) { - *cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK); - bzero(*cookiep, sizeof(struct smg_screen)); + *cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK|M_ZERO); *curxp = *curyp = *defattrp = 0; return 0; } diff --git a/sys/dev/ic/hd44780_subr.c b/sys/dev/ic/hd44780_subr.c index de832ae4291e..3d859708375d 100644 --- a/sys/dev/ic/hd44780_subr.c +++ b/sys/dev/ic/hd44780_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: hd44780_subr.c,v 1.15 2008/04/10 09:05:53 he Exp $ */ +/* $NetBSD: hd44780_subr.c,v 1.16 2008/12/19 18:49:38 cegger Exp $ */ /* * Copyright (c) 2002 Dennis I. Chernoivanov @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.15 2008/04/10 09:05:53 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hd44780_subr.c,v 1.16 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -276,8 +276,8 @@ hlcd_alloc_screen(v, type, cookiep, curxp, curyp, defattrp) { struct hlcd_screen *hdscr = v, *new; - new = *cookiep = malloc(sizeof(struct hlcd_screen), M_DEVBUF, M_WAITOK); - bzero(*cookiep, sizeof(struct hlcd_screen)); + new = *cookiep = malloc(sizeof(struct hlcd_screen), + M_DEVBUF, M_WAITOK|M_ZERO); new->hlcd_sc = hdscr->hlcd_sc; new->image = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); memset(new->image, ' ', PAGE_SIZE); diff --git a/sys/dev/pci/cxgb_sge.c b/sys/dev/pci/cxgb_sge.c index 0e6f4379cf8c..2ea2589eab6d 100644 --- a/sys/dev/pci/cxgb_sge.c +++ b/sys/dev/pci/cxgb_sge.c @@ -29,7 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.9 2008/01/17 06:03:21 jklos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.10 2008/12/19 18:49:38 cegger Exp $"); #endif #ifdef __FreeBSD__ __FBSDID("$FreeBSD: src/sys/dev/cxgb/cxgb_sge.c,v 1.30 2007/09/09 04:34:03 kmacy Exp $"); @@ -797,8 +797,7 @@ alloc_ring(adapter_t *sc, size_t nelem, size_t elem_size, size_t sw_size, if (sw_size) { len = nelem * sw_size; - s = malloc(len, M_DEVBUF, M_WAITOK); - bzero(s, len); + s = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); *(void **)sdesc = s; } if (parent_entry_tag == NULL) @@ -844,8 +843,7 @@ alloc_ring(adapter_t *sc, size_t nelem, size_t elem_size, size_t sw_size, if (sw_size) { len = nelem * sw_size; - s = malloc(len, M_DEVBUF, M_WAITOK); - bzero(s, len); + s = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); *(void **)sdesc = s; } diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 2f7e280ab299..b911d83a7208 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $NetBSD: ubsec.c,v 1.16 2008/04/10 19:13:38 cegger Exp $ */ +/* $NetBSD: ubsec.c,v 1.17 2008/12/19 18:49:38 cegger Exp $ */ /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ /* $OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.16 2008/04/10 19:13:38 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.17 2008/12/19 18:49:38 cegger Exp $"); #undef UBSEC_DEBUG @@ -2545,10 +2545,9 @@ ubsec_kprocess_rsapriv(struct ubsec_softc *sc, struct cryptkop *krp, goto errout; } - rp = (struct ubsec_q2_rsapriv *)malloc(sizeof *rp, M_DEVBUF, M_NOWAIT); + rp = malloc(sizeof *rp, M_DEVBUF, M_NOWAIT|M_ZERO); if (rp == NULL) return (ENOMEM); - bzero(rp, sizeof *rp); rp->rpr_krp = krp; rp->rpr_q.q_type = UBS_CTXOP_RSAPRIV; diff --git a/sys/dist/pf/net/if_pflog.c b/sys/dist/pf/net/if_pflog.c index cf0664a9452d..ce9953ea5f20 100644 --- a/sys/dist/pf/net/if_pflog.c +++ b/sys/dist/pf/net/if_pflog.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_pflog.c,v 1.13 2008/11/07 00:20:13 dyoung Exp $ */ +/* $NetBSD: if_pflog.c,v 1.14 2008/12/19 18:49:38 cegger Exp $ */ /* $OpenBSD: if_pflog.c,v 1.24 2007/05/26 17:13:30 jason Exp $ */ /* @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pflog.c,v 1.13 2008/11/07 00:20:13 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pflog.c,v 1.14 2008/12/19 18:49:38 cegger Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -134,9 +134,8 @@ pflog_clone_create(struct if_clone *ifc, int unit) if (unit >= PFLOGIFS_MAX) return (EINVAL); - if ((pflogif = malloc(sizeof(*pflogif), M_DEVBUF, M_NOWAIT)) == NULL) + if ((pflogif = malloc(sizeof(*pflogif), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) return (ENOMEM); - bzero(pflogif, sizeof(*pflogif)); pflogif->sc_unit = unit; ifp = &pflogif->sc_if; diff --git a/sys/dist/pf/net/pf_if.c b/sys/dist/pf/net/pf_if.c index cbdc4d57c01e..00c959062964 100644 --- a/sys/dist/pf/net/pf_if.c +++ b/sys/dist/pf/net/pf_if.c @@ -1,4 +1,4 @@ -/* $NetBSD: pf_if.c,v 1.17 2008/12/19 14:07:37 cegger Exp $ */ +/* $NetBSD: pf_if.c,v 1.18 2008/12/19 18:49:38 cegger Exp $ */ /* $OpenBSD: pf_if.c,v 1.47 2007/07/13 09:17:48 markus Exp $ */ /* @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pf_if.c,v 1.17 2008/12/19 14:07:37 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pf_if.c,v 1.18 2008/12/19 18:49:38 cegger Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -181,10 +181,9 @@ pfi_kif_get(const char *kif_name) return (kif); /* create new one */ - if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT)) == NULL) + if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT|M_ZERO)) == NULL) return (NULL); - bzero(kif, sizeof(*kif)); strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name)); #ifdef __NetBSD__ /* time_second is not valid yet */ diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 224d7e2b06e7..4429db875b22 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntfs_vfsops.c,v 1.73 2008/12/17 20:51:35 cegger Exp $ */ +/* $NetBSD: ntfs_vfsops.c,v 1.74 2008/12/19 18:49:38 cegger Exp $ */ /*- * Copyright (c) 1998, 1999 Semen Ustimenko @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.73 2008/12/17 20:51:35 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.74 2008/12/19 18:49:38 cegger Exp $"); #include #include @@ -334,8 +334,7 @@ ntfs_mountfs(devvp, mp, argsp, l) error = bread(devvp, BBLOCK, BBSIZE, NOCRED, 0, &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 , 0 ); bp = NULL; diff --git a/sys/fs/udf/udf_subr.c b/sys/fs/udf/udf_subr.c index 394007719c4a..7a9d53c61613 100644 --- a/sys/fs/udf/udf_subr.c +++ b/sys/fs/udf/udf_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: udf_subr.c,v 1.82 2008/12/18 15:41:44 reinoud Exp $ */ +/* $NetBSD: udf_subr.c,v 1.83 2008/12/19 18:49:39 cegger Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -29,7 +29,7 @@ #include #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.82 2008/12/18 15:41:44 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.83 2008/12/19 18:49:39 cegger Exp $"); #endif /* not lint */ @@ -3643,8 +3643,7 @@ udf_write_terminator(struct udf_mount *ump, uint32_t sector) union dscrptr *dscr; int error; - dscr = malloc(ump->discinfo.sector_size, M_TEMP, M_WAITOK); - bzero(dscr, ump->discinfo.sector_size); + dscr = malloc(ump->discinfo.sector_size, M_TEMP, M_WAITOK|M_ZERO); udf_inittag(ump, &dscr->tag, TAGID_TERM, sector); /* CRC length for an anchor is 512 - tag length; defined in Ecma 167 */ @@ -4556,8 +4555,7 @@ udf_dir_attach(struct udf_mount *ump, struct udf_node *dir_node, file_char = UDF_FILE_CHAR_DIR; /* malloc scrap buffer */ - fid = malloc(lb_size, M_TEMP, M_WAITOK); - bzero(fid, lb_size); + fid = malloc(lb_size, M_TEMP, M_WAITOK|M_ZERO); /* calculate _minimum_ fid size */ unix_to_udf_name((char *) fid->data, &fid->l_fi, diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 0c3d09ed43cc..4996082639c6 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.28 2008/12/17 20:51:37 cegger Exp $ */ +/* $NetBSD: ip_carp.c,v 1.29 2008/12/19 18:49:39 cegger Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.28 2008/12/17 20:51:37 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.29 2008/12/19 18:49:39 cegger Exp $"); /* * TODO: @@ -755,10 +755,9 @@ carp_clone_create(struct if_clone *ifc, int unit) struct carp_softc *sc; struct ifnet *ifp; - sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); + sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO); if (!sc) return (ENOMEM); - bzero(sc, sizeof(*sc)); sc->sc_suppress = 0; sc->sc_advbase = CARP_DFLTINTV; diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 42a1e961e690..417d4d8b3dda 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_mroute.c,v 1.116 2008/10/01 16:01:51 rmind Exp $ */ +/* $NetBSD: ip_mroute.c,v 1.117 2008/12/19 18:49:39 cegger Exp $ */ /* * Copyright (c) 1992, 1993 @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.116 2008/10/01 16:01:51 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.117 2008/12/19 18:49:39 cegger Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -841,8 +841,7 @@ add_vif(struct vifctl *vifcp) return (EINVAL); /* Create a fake encapsulation interface. */ - ifp = (struct ifnet *)malloc(sizeof(*ifp), M_MRTABLE, M_WAITOK); - bzero(ifp, sizeof(*ifp)); + ifp = malloc(sizeof(*ifp), M_MRTABLE, M_WAITOK|M_ZERO); snprintf(ifp->if_xname, sizeof(ifp->if_xname), "mdecap%d", vifcp->vifc_vifi); diff --git a/sys/netinet6/ah_aesxcbcmac.c b/sys/netinet6/ah_aesxcbcmac.c index 851fe241f202..8ede9768f007 100644 --- a/sys/netinet6/ah_aesxcbcmac.c +++ b/sys/netinet6/ah_aesxcbcmac.c @@ -1,4 +1,4 @@ -/* $NetBSD: ah_aesxcbcmac.c,v 1.4 2007/05/23 17:14:59 christos Exp $ */ +/* $NetBSD: ah_aesxcbcmac.c,v 1.5 2008/12/19 18:49:39 cegger Exp $ */ /* $KAME: ah_aesxcbcmac.c,v 1.7 2004/06/02 05:53:14 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ah_aesxcbcmac.c,v 1.4 2007/05/23 17:14:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ah_aesxcbcmac.c,v 1.5 2008/12/19 18:49:39 cegger Exp $"); #include #include @@ -83,10 +83,9 @@ ah_aes_xcbc_mac_init(struct ah_algorithm_state *state, struct secasvar * sav) panic("ah_aes_xcbc_mac_init: what?"); state->sav = sav; - state->foo = (void *)malloc(sizeof(aesxcbc_ctx), M_TEMP, M_NOWAIT); + state->foo = malloc(sizeof(aesxcbc_ctx), M_TEMP, M_NOWAIT|M_ZERO); if (!state->foo) return ENOBUFS; - bzero(state->foo, sizeof(aesxcbc_ctx)); ctx = (aesxcbc_ctx *)state->foo; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 5af771f85f2b..40723ca5e7c6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.142 2008/11/07 00:20:18 dyoung Exp $ */ +/* $NetBSD: in6.c,v 1.143 2008/12/19 18:49:39 cegger Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.142 2008/11/07 00:20:18 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.143 2008/12/19 18:49:39 cegger Exp $"); #include "opt_inet.h" #include "opt_pfil_hooks.h" @@ -2186,17 +2186,13 @@ in6_domifattach(struct ifnet *ifp) { struct in6_ifextra *ext; - ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK); - bzero(ext, sizeof(*ext)); + ext = malloc(sizeof(*ext), M_IFADDR, M_WAITOK|M_ZERO); - ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat), - M_IFADDR, M_WAITOK); - bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat)); + ext->in6_ifstat = malloc(sizeof(struct in6_ifstat), + M_IFADDR, M_WAITOK|M_ZERO); - ext->icmp6_ifstat = - (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat), - M_IFADDR, M_WAITOK); - bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat)); + ext->icmp6_ifstat = malloc(sizeof(struct icmp6_ifstat), + M_IFADDR, M_WAITOK|M_ZERO); ext->nd_ifinfo = nd6_ifattach(ifp); ext->scope6_id = scope6_ifattach(ifp); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 36936f671404..842104e965db 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.76 2008/10/24 21:30:34 dyoung Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.77 2008/12/19 18:49:39 cegger Exp $ */ /* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.76 2008/10/24 21:30:34 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.77 2008/12/19 18:49:39 cegger Exp $"); #include #include @@ -824,10 +824,9 @@ pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) { struct nd_pfxrouter *new; - new = (struct nd_pfxrouter *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT|M_ZERO); if (new == NULL) return; - bzero(new, sizeof(*new)); new->router = dr; LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); @@ -868,10 +867,9 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, int error; error = 0; - new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT|M_ZERO); if (new == NULL) return ENOMEM; - bzero(new, sizeof(*new)); new->ndpr_ifp = pr->ndpr_ifp; new->ndpr_prefix = pr->ndpr_prefix; new->ndpr_plen = pr->ndpr_plen; diff --git a/sys/netiso/tp_subr.c b/sys/netiso/tp_subr.c index cd1430ba72ab..9ad4c0dc3cca 100644 --- a/sys/netiso/tp_subr.c +++ b/sys/netiso/tp_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: tp_subr.c,v 1.21 2007/03/04 06:03:33 christos Exp $ */ +/* $NetBSD: tp_subr.c,v 1.22 2008/12/19 18:49:39 cegger Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -67,7 +67,7 @@ SOFTWARE. */ #include -__KERNEL_RCSID(0, "$NetBSD: tp_subr.c,v 1.21 2007/03/04 06:03:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tp_subr.c,v 1.22 2008/12/19 18:49:39 cegger Exp $"); #include #include @@ -979,8 +979,7 @@ tp_rsyset(struct tp_pcb *tpcb) maxcredit *= sizeof(struct mbuf *); if (tpcb->tp_rsyq) tp_rsyflush(tpcb); - if ((rsyq = (void *) malloc(maxcredit, M_PCB, M_NOWAIT)) != NULL) - bzero(rsyq, maxcredit); + rsyq = malloc(maxcredit, M_PCB, M_NOWAIT|M_ZERO); tpcb->tp_rsyq = (struct mbuf **) rsyq; } diff --git a/sys/netsmb/smb_crypt.c b/sys/netsmb/smb_crypt.c index 430515a3b07c..1ae01ee9f33d 100644 --- a/sys/netsmb/smb_crypt.c +++ b/sys/netsmb/smb_crypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: smb_crypt.c,v 1.9 2008/06/24 10:37:19 gmcgarry Exp $ */ +/* $NetBSD: smb_crypt.c,v 1.10 2008/12/19 18:49:39 cegger Exp $ */ /* * Copyright (c) 2000-2001, Boris Popov @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smb_crypt.c,v 1.9 2008/06/24 10:37:19 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_crypt.c,v 1.10 2008/12/19 18:49:39 cegger Exp $"); #include #include @@ -94,8 +94,7 @@ smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN) #ifdef NETSMBCRYPTO u_char *p, *P14, *S21; - p = malloc(14 + 21, M_SMBTEMP, M_WAITOK); - bzero(p, 14 + 21); + p = malloc(14 + 21, M_SMBTEMP, M_WAITOK|M_ZERO); P14 = p; S21 = p + 14; bcopy(apwd, P14, min(14, strlen(apwd)));