Convert more malloc+bzero to malloc+M_ZERO.
Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
This commit is contained in:
parent
b1f3daafde
commit
7cc0979fd6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69781
@ -522,8 +522,7 @@ i686_mrinit(struct mem_range_softc *sc)
|
||||
|
||||
sc->mr_desc =
|
||||
(struct mem_range_desc *)malloc(nmdesc * sizeof(struct mem_range_desc),
|
||||
M_MEMDESC, M_WAITOK);
|
||||
bzero(sc->mr_desc, nmdesc * sizeof(struct mem_range_desc));
|
||||
M_MEMDESC, M_WAITOK | M_ZERO);
|
||||
sc->mr_ndesc = nmdesc;
|
||||
|
||||
mrd = sc->mr_desc;
|
||||
|
@ -250,14 +250,13 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
|
||||
int maxpages;
|
||||
|
||||
*mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
if (*mapp == NULL) {
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (*mapp == NULL)
|
||||
return (ENOMEM);
|
||||
} else {
|
||||
/* Initialize the new map */
|
||||
bzero(*mapp, sizeof(**mapp));
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
}
|
||||
|
||||
/* Initialize the new map */
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
|
||||
/*
|
||||
* Attempt to add pages to our pool on a per-instance
|
||||
* basis up to a sane limit.
|
||||
@ -551,11 +550,10 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
|
||||
int s;
|
||||
|
||||
bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
|
||||
if (bpage == NULL)
|
||||
break;
|
||||
bzero(bpage, sizeof(*bpage));
|
||||
bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF,
|
||||
M_NOWAIT, 0ul,
|
||||
dmat->lowaddr,
|
||||
|
@ -331,10 +331,9 @@ nexus_add_child(device_t bus, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
struct nexus_device *ndev;
|
||||
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT);
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
|
||||
if (!ndev)
|
||||
return(0);
|
||||
bzero(ndev, sizeof(struct nexus_device));
|
||||
resource_list_init(&ndev->nx_resources);
|
||||
ndev->nx_pcibus = -1;
|
||||
|
||||
|
@ -331,10 +331,9 @@ nexus_add_child(device_t bus, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
struct nexus_device *ndev;
|
||||
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT);
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
|
||||
if (!ndev)
|
||||
return(0);
|
||||
bzero(ndev, sizeof(struct nexus_device));
|
||||
resource_list_init(&ndev->nx_resources);
|
||||
ndev->nx_pcibus = -1;
|
||||
|
||||
|
@ -287,11 +287,10 @@ cpu_coredump(p, vp, cred)
|
||||
int error;
|
||||
caddr_t tempuser;
|
||||
|
||||
tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK);
|
||||
tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK | M_ZERO);
|
||||
if (!tempuser)
|
||||
return EINVAL;
|
||||
|
||||
bzero(tempuser, ctob(UPAGES));
|
||||
bcopy(p->p_addr, tempuser, sizeof(struct user));
|
||||
bcopy(p->p_md.md_regs,
|
||||
tempuser + ((caddr_t) p->p_md.md_regs - (caddr_t) p->p_addr),
|
||||
|
@ -546,10 +546,10 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
if (ithd == NULL || ithd->it_ih == NULL) {
|
||||
/* first handler for this irq. */
|
||||
if (ithd == NULL) {
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF, M_WAITOK);
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (ithd == NULL)
|
||||
return (NULL);
|
||||
bzero(ithd, sizeof(struct ithd));
|
||||
ithd->irq = irq;
|
||||
ithds[irq] = ithd;
|
||||
}
|
||||
@ -620,10 +620,9 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
else
|
||||
strcat(p->p_comm, "+");
|
||||
}
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK);
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (idesc == NULL)
|
||||
return (NULL);
|
||||
bzero(idesc, sizeof (struct intrhand));
|
||||
|
||||
idesc->ih_handler = handler;
|
||||
idesc->ih_argument = arg;
|
||||
|
@ -546,10 +546,10 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
if (ithd == NULL || ithd->it_ih == NULL) {
|
||||
/* first handler for this irq. */
|
||||
if (ithd == NULL) {
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF, M_WAITOK);
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (ithd == NULL)
|
||||
return (NULL);
|
||||
bzero(ithd, sizeof(struct ithd));
|
||||
ithd->irq = irq;
|
||||
ithds[irq] = ithd;
|
||||
}
|
||||
@ -620,10 +620,9 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
else
|
||||
strcat(p->p_comm, "+");
|
||||
}
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK);
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (idesc == NULL)
|
||||
return (NULL);
|
||||
bzero(idesc, sizeof (struct intrhand));
|
||||
|
||||
idesc->ih_handler = handler;
|
||||
idesc->ih_argument = arg;
|
||||
|
@ -553,12 +553,11 @@ oltr_pci_attach(pcici_t config_id, int unit)
|
||||
|
||||
s = splimp();
|
||||
|
||||
sc = malloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT);
|
||||
sc = malloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc == NULL) {
|
||||
printf("oltr%d: no memory for softc struct!\n", unit);
|
||||
goto config_failed;
|
||||
}
|
||||
bzero(sc, sizeof(struct oltr_softc));
|
||||
sc->unit = unit;
|
||||
sc->state = OL_UNKNOWN;
|
||||
ifp = &sc->arpcom.ac_if;
|
||||
|
@ -397,8 +397,7 @@ arattach_pci(int unit, vm_offset_t mem_addr)
|
||||
struct ar_hardc *hc;
|
||||
u_int i, tmp;
|
||||
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK);
|
||||
bzero(hc, sizeof(struct ar_hardc));
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
hc->cunit = unit;
|
||||
hc->mem_start = (caddr_t)mem_addr;
|
||||
@ -1139,11 +1138,10 @@ arc_init(struct ar_hardc *hc)
|
||||
u_int descneeded;
|
||||
u_char isr, mar;
|
||||
|
||||
MALLOC(sc, struct ar_softc *,
|
||||
hc->numports * sizeof(struct ar_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
bzero(sc, hc->numports * sizeof(struct ar_softc));
|
||||
hc->sc = sc;
|
||||
|
||||
hc->txc_dtr[0] = AR_TXC_DTR_NOTRESET |
|
||||
@ -2234,12 +2232,11 @@ ngar_rcvmsg(node_p node, struct ng_mesg *msg,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -397,8 +397,7 @@ arattach_pci(int unit, vm_offset_t mem_addr)
|
||||
struct ar_hardc *hc;
|
||||
u_int i, tmp;
|
||||
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK);
|
||||
bzero(hc, sizeof(struct ar_hardc));
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
hc->cunit = unit;
|
||||
hc->mem_start = (caddr_t)mem_addr;
|
||||
@ -1139,11 +1138,10 @@ arc_init(struct ar_hardc *hc)
|
||||
u_int descneeded;
|
||||
u_char isr, mar;
|
||||
|
||||
MALLOC(sc, struct ar_softc *,
|
||||
hc->numports * sizeof(struct ar_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
bzero(sc, hc->numports * sizeof(struct ar_softc));
|
||||
hc->sc = sc;
|
||||
|
||||
hc->txc_dtr[0] = AR_TXC_DTR_NOTRESET |
|
||||
@ -2234,12 +2232,11 @@ ngar_rcvmsg(node_p node, struct ng_mesg *msg,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -356,17 +356,14 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
||||
fkeymap_size =
|
||||
sizeof(default_fkeytab)/sizeof(default_fkeytab[0]);
|
||||
} else if (*kbdp == NULL) {
|
||||
*kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT);
|
||||
if (kbd == NULL)
|
||||
return ENOMEM;
|
||||
bzero(kbd, sizeof(*kbd));
|
||||
state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT);
|
||||
*kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
keymap = malloc(sizeof(key_map), M_DEVBUF, M_NOWAIT);
|
||||
accmap = malloc(sizeof(accent_map), M_DEVBUF, M_NOWAIT);
|
||||
fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_NOWAIT);
|
||||
fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]);
|
||||
if ((state == NULL) || (keymap == NULL) || (accmap == NULL)
|
||||
|| (fkeymap == NULL)) {
|
||||
if ((kbd == NULL) || (state == NULL) || (keymap == NULL)
|
||||
|| (accmap == NULL) || (fkeymap == NULL)) {
|
||||
if (state != NULL)
|
||||
free(state, M_DEVBUF);
|
||||
if (keymap != NULL)
|
||||
@ -375,10 +372,10 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
||||
free(accmap, M_DEVBUF);
|
||||
if (fkeymap != NULL)
|
||||
free(fkeymap, M_DEVBUF);
|
||||
free(kbd, M_DEVBUF);
|
||||
if (kbd == NULL)
|
||||
free(kbd, M_DEVBUF);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero(state, sizeof(*state));
|
||||
} else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -111,10 +111,9 @@ atkbdc_softc_t
|
||||
sc = atkbdc_softc[unit];
|
||||
if (sc == NULL) {
|
||||
sc = atkbdc_softc[unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return NULL;
|
||||
bzero(sc, sizeof(*sc));
|
||||
}
|
||||
return sc;
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
return;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
|
@ -146,10 +146,10 @@ atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
return;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
|
@ -598,8 +598,8 @@ ccdinterleave(cs, unit)
|
||||
* Chances are this is too big, but we don't care.
|
||||
*/
|
||||
size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo);
|
||||
cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF, M_WAITOK);
|
||||
bzero((caddr_t)cs->sc_itable, size);
|
||||
cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
|
||||
/*
|
||||
* Trivial case: no interleave (actually interleave of disk size).
|
||||
|
@ -553,10 +553,9 @@ cyattach_common(cy_iobase, cy_align)
|
||||
struct com_s *com;
|
||||
int s;
|
||||
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT);
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (com == NULL)
|
||||
break;
|
||||
bzero(com, sizeof *com);
|
||||
com->unit = unit;
|
||||
com->gfrcr_image = firmware_version;
|
||||
if (CY_RTS_DTR_SWAPPED(firmware_version)) {
|
||||
|
@ -553,10 +553,9 @@ cyattach_common(cy_iobase, cy_align)
|
||||
struct com_s *com;
|
||||
int s;
|
||||
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT);
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (com == NULL)
|
||||
break;
|
||||
bzero(com, sizeof *com);
|
||||
com->unit = unit;
|
||||
com->gfrcr_image = firmware_version;
|
||||
if (CY_RTS_DTR_SWAPPED(firmware_version)) {
|
||||
|
@ -173,12 +173,11 @@ eisa_probe(device_t dev)
|
||||
|
||||
/* Prepare an eisa_device_node for this slot */
|
||||
e_dev = (struct eisa_device *)malloc(sizeof(*e_dev),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (!e_dev) {
|
||||
device_printf(dev, "cannot malloc eisa_device");
|
||||
break; /* Try to attach what we have already */
|
||||
}
|
||||
bzero(e_dev, sizeof(*e_dev));
|
||||
|
||||
e_dev->id = eisa_id;
|
||||
|
||||
|
@ -82,17 +82,16 @@ vid_realloc_array(void)
|
||||
|
||||
s = spltty();
|
||||
newsize = ((adapters + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA;
|
||||
new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK);
|
||||
new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF, M_WAITOK);
|
||||
new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
#ifdef FB_INSTALL_CDEV
|
||||
new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF, M_WAITOK);
|
||||
new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
#endif
|
||||
bzero(new_adp, sizeof(*new_adp)*newsize);
|
||||
bzero(new_vidsw, sizeof(*new_vidsw)*newsize);
|
||||
bcopy(adapter, new_adp, sizeof(*adapter)*adapters);
|
||||
bcopy(vidsw, new_vidsw, sizeof(*vidsw)*adapters);
|
||||
#ifdef FB_INSTALL_CDEV
|
||||
bzero(new_cdevsw, sizeof(*new_cdevsw)*newsize);
|
||||
bcopy(vidcdevsw, new_cdevsw, sizeof(*vidcdevsw)*adapters);
|
||||
#endif
|
||||
if (adapters > 1) {
|
||||
|
@ -818,10 +818,9 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
ivar = malloc(sizeof *ivar, M_DEVBUF /* XXX */, M_NOWAIT);
|
||||
ivar = malloc(sizeof *ivar, M_DEVBUF /* XXX */, M_NOWAIT | M_ZERO);
|
||||
if (ivar == NULL)
|
||||
return;
|
||||
bzero(ivar, sizeof *ivar);
|
||||
if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0)
|
||||
ivar->fdunit = 0;
|
||||
child = device_add_child(dev, name, unit);
|
||||
|
@ -587,15 +587,14 @@ fxp_attach_common(sc, enaddr)
|
||||
DELAY(10);
|
||||
|
||||
sc->cbl_base = malloc(sizeof(struct fxp_cb_tx) * FXP_NTXCB,
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc->cbl_base == NULL)
|
||||
goto fail;
|
||||
bzero(sc->cbl_base, sizeof(struct fxp_cb_tx) * FXP_NTXCB);
|
||||
|
||||
sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF, M_NOWAIT);
|
||||
sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (sc->fxp_stats == NULL)
|
||||
goto fail;
|
||||
bzero(sc->fxp_stats, sizeof(struct fxp_stats));
|
||||
|
||||
sc->mcsp = malloc(sizeof(struct fxp_cb_mcs), M_DEVBUF, M_NOWAIT);
|
||||
if (sc->mcsp == NULL)
|
||||
|
@ -191,10 +191,10 @@ ida_init(struct ida_softc *ida)
|
||||
bioq_init(&ida->bio_queue);
|
||||
|
||||
ida->qcbs = (struct ida_qcb *)
|
||||
malloc(IDA_QCB_MAX * sizeof(struct ida_qcb), M_DEVBUF, M_NOWAIT);
|
||||
malloc(IDA_QCB_MAX * sizeof(struct ida_qcb), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (ida->qcbs == NULL)
|
||||
return (ENOMEM);
|
||||
bzero(ida->qcbs, IDA_QCB_MAX * sizeof(struct ida_qcb));
|
||||
|
||||
/*
|
||||
* Create our DMA tags
|
||||
|
@ -317,12 +317,11 @@ isp_pci_attach(device_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
pcs = malloc(sizeof (struct isp_pcisoftc), M_DEVBUF, M_NOWAIT);
|
||||
pcs = malloc(sizeof (struct isp_pcisoftc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (pcs == NULL) {
|
||||
device_printf(dev, "cannot allocate softc\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
bzero(pcs, sizeof (struct isp_pcisoftc));
|
||||
|
||||
/*
|
||||
* Figure out which we should try first - memory mapping or i/o mapping?
|
||||
@ -443,12 +442,11 @@ isp_pci_attach(device_t dev)
|
||||
PCI_MBOX_REGS2100_OFF;
|
||||
}
|
||||
isp = &pcs->pci_isp;
|
||||
isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT);
|
||||
isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (isp->isp_param == NULL) {
|
||||
device_printf(dev, "cannot allocate parameter data\n");
|
||||
goto bad;
|
||||
}
|
||||
bzero(isp->isp_param, psize);
|
||||
isp->isp_mdvec = mdvp;
|
||||
isp->isp_type = basetype;
|
||||
isp->isp_revision = pci_get_revid(dev);
|
||||
@ -850,12 +848,11 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
||||
}
|
||||
|
||||
len = sizeof (XS_T **) * isp->isp_maxcmds;
|
||||
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK);
|
||||
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (isp->isp_xflist == NULL) {
|
||||
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
||||
return (1);
|
||||
}
|
||||
bzero(isp->isp_xflist, len);
|
||||
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
|
||||
pci->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, M_WAITOK);
|
||||
if (pci->dmaps == NULL) {
|
||||
|
@ -356,17 +356,14 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
||||
fkeymap_size =
|
||||
sizeof(default_fkeytab)/sizeof(default_fkeytab[0]);
|
||||
} else if (*kbdp == NULL) {
|
||||
*kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT);
|
||||
if (kbd == NULL)
|
||||
return ENOMEM;
|
||||
bzero(kbd, sizeof(*kbd));
|
||||
state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT);
|
||||
*kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
keymap = malloc(sizeof(key_map), M_DEVBUF, M_NOWAIT);
|
||||
accmap = malloc(sizeof(accent_map), M_DEVBUF, M_NOWAIT);
|
||||
fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_NOWAIT);
|
||||
fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]);
|
||||
if ((state == NULL) || (keymap == NULL) || (accmap == NULL)
|
||||
|| (fkeymap == NULL)) {
|
||||
if ((kbd == NULL) || (state == NULL) || (keymap == NULL)
|
||||
|| (accmap == NULL) || (fkeymap == NULL)) {
|
||||
if (state != NULL)
|
||||
free(state, M_DEVBUF);
|
||||
if (keymap != NULL)
|
||||
@ -375,10 +372,10 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
||||
free(accmap, M_DEVBUF);
|
||||
if (fkeymap != NULL)
|
||||
free(fkeymap, M_DEVBUF);
|
||||
free(kbd, M_DEVBUF);
|
||||
if (kbd == NULL)
|
||||
free(kbd, M_DEVBUF);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero(state, sizeof(*state));
|
||||
} else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -111,10 +111,9 @@ atkbdc_softc_t
|
||||
sc = atkbdc_softc[unit];
|
||||
if (sc == NULL) {
|
||||
sc = atkbdc_softc[unit]
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
= malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return NULL;
|
||||
bzero(sc, sizeof(*sc));
|
||||
}
|
||||
return sc;
|
||||
}
|
||||
|
@ -80,19 +80,18 @@ kbd_realloc_array(void)
|
||||
|
||||
s = spltty();
|
||||
newsize = ((keyboards + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA;
|
||||
new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT);
|
||||
new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (new_kbd == NULL) {
|
||||
splx(s);
|
||||
return ENOMEM;
|
||||
}
|
||||
new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF, M_NOWAIT);
|
||||
new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF,
|
||||
M_NOWAIT|M_ZERO);
|
||||
if (new_kbdsw == NULL) {
|
||||
free(new_kbd, M_DEVBUF);
|
||||
splx(s);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero(new_kbd, sizeof(*new_kbd)*newsize);
|
||||
bzero(new_kbdsw, sizeof(*new_kbdsw)*newsize);
|
||||
bcopy(keyboard, new_kbd, sizeof(*keyboard)*keyboards);
|
||||
bcopy(kbdsw, new_kbdsw, sizeof(*kbdsw)*keyboards);
|
||||
if (keyboards > 1) {
|
||||
|
@ -1342,12 +1342,11 @@ ng_lmc_rcvmsg(node_p node, struct ng_mesg *msg,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(resp, struct ng_mesg *, resplen, M_NETGRAPH,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(resp, resplen);
|
||||
arg = (resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -137,10 +137,9 @@ lmc_pci_attach(pcici_t config_id, int unit)
|
||||
/*
|
||||
* allocate memory for the softc
|
||||
*/
|
||||
sc = (lmc_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
sc = (lmc_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
bzero(sc, sizeof(*sc)); /* Zero out the softc*/
|
||||
|
||||
revinfo = PCI_CONF_READ(PCI_CFRV) & 0xFF;
|
||||
id = PCI_CONF_READ(PCI_CFID);
|
||||
|
@ -104,11 +104,9 @@ lnc_pci_attach(config_id, unit)
|
||||
data |= PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN;
|
||||
pci_cfgwrite(config_id, PCIR_COMMAND, data, 4);
|
||||
|
||||
sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
|
||||
sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
|
||||
if (sc) {
|
||||
bzero (sc, sizeof *sc);
|
||||
|
||||
sc->rap = iobase + PCNET_RAP;
|
||||
sc->rdp = iobase + PCNET_RDP;
|
||||
sc->bdp = iobase + PCNET_BDP;
|
||||
|
@ -257,8 +257,7 @@ mdstrategy_malloc(struct bio *bp)
|
||||
*secpp = (u_char *)(uintptr_t)uc;
|
||||
} else {
|
||||
if (!secpp) {
|
||||
MALLOC(secpp, u_char **, (secno + nsec + 1) * sizeof(u_char *), M_MD, M_WAITOK);
|
||||
bzero(secpp, (secno + nsec + 1) * sizeof(u_char *));
|
||||
MALLOC(secpp, u_char **, (secno + nsec + 1) * sizeof(u_char *), M_MD, M_WAITOK | M_ZERO);
|
||||
bcopy(sc->secp, secpp, sc->nsecp * sizeof(u_char *));
|
||||
FREE(sc->secp, M_MD);
|
||||
sc->secp = secpp;
|
||||
@ -356,8 +355,7 @@ mdcreate(int unit)
|
||||
if (sc->unit == unit)
|
||||
return (NULL);
|
||||
}
|
||||
MALLOC(sc, struct md_s *,sizeof(*sc), M_MD, M_WAITOK);
|
||||
bzero(sc, sizeof(*sc));
|
||||
MALLOC(sc, struct md_s *,sizeof(*sc), M_MD, M_WAITOK | M_ZERO);
|
||||
LIST_INSERT_HEAD(&md_softc_list, sc, list);
|
||||
sc->unit = unit;
|
||||
bioq_init(&sc->bio_queue);
|
||||
@ -397,8 +395,7 @@ mdcreate_malloc(int unit)
|
||||
sc->type = MD_MALLOC;
|
||||
|
||||
sc->nsect = MD_NSECT; /* for now */
|
||||
MALLOC(sc->secp, u_char **, sizeof(u_char *), M_MD, M_WAITOK);
|
||||
bzero(sc->secp, sizeof(u_char *));
|
||||
MALLOC(sc->secp, u_char **, sizeof(u_char *), M_MD, M_WAITOK | M_ZERO);
|
||||
sc->nsecp = 1;
|
||||
printf("md%d: Malloc disk\n", sc->unit);
|
||||
}
|
||||
|
@ -1012,8 +1012,7 @@ musycc_newhook(node_p node, hook_p hook, const char *name)
|
||||
return (EINVAL);
|
||||
|
||||
if (sc->chan[chan] == NULL) {
|
||||
MALLOC(sch, struct schan *, sizeof(*sch), M_MUSYCC, M_WAITOK);
|
||||
bzero(sch, sizeof(*sch));
|
||||
MALLOC(sch, struct schan *, sizeof(*sch), M_MUSYCC, M_WAITOK | M_ZERO);
|
||||
sch->sc = sc;
|
||||
sch->state = DOWN;
|
||||
sch->chan = chan;
|
||||
@ -1340,8 +1339,7 @@ musycc_attach(device_t self)
|
||||
f = pci_get_function(self);
|
||||
/* For function zero allocate a csoftc */
|
||||
if (f == 0) {
|
||||
MALLOC(csc, struct csoftc *, sizeof(*csc), M_MUSYCC, M_WAITOK);
|
||||
bzero(csc, sizeof(*csc));
|
||||
MALLOC(csc, struct csoftc *, sizeof(*csc), M_MUSYCC, M_WAITOK | M_ZERO);
|
||||
csc->bus = pci_get_bus(self);
|
||||
csc->slot = pci_get_slot(self);
|
||||
LIST_INSERT_HEAD(&sc_list, csc, list);
|
||||
@ -1415,8 +1413,7 @@ musycc_attach(device_t self)
|
||||
sc->reg = (struct globalr *)
|
||||
(csc->virbase[0] + i * 0x800);
|
||||
MALLOC(sc->mycg, struct mycg *,
|
||||
sizeof(struct mycg), M_MUSYCC, M_WAITOK);
|
||||
bzero(sc->mycg, sizeof(struct mycg));
|
||||
sizeof(struct mycg), M_MUSYCC, M_WAITOK | M_ZERO);
|
||||
sc->ram = &sc->mycg->cg;
|
||||
|
||||
error = ng_make_node_common(&ngtypestruct, &sc->node);
|
||||
|
@ -112,8 +112,7 @@ null_modevent(module_t mod, int type, void *data)
|
||||
case MOD_LOAD:
|
||||
if (bootverbose)
|
||||
printf("null: <null device, zero device>\n");
|
||||
zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
|
||||
bzero(zbuf, PAGE_SIZE);
|
||||
zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO);
|
||||
zero_dev = make_dev(&zero_cdevsw, ZERO_MINOR, UID_ROOT,
|
||||
GID_WHEEL, 0666, "zero");
|
||||
null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT,
|
||||
|
@ -169,11 +169,10 @@ pdq_pci_attach(
|
||||
pci_conf_write(config_id, PCI_CFLT, data);
|
||||
}
|
||||
|
||||
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
|
||||
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
||||
bzero(sc, sizeof(pdq_softc_t)); /* Zero out the softc*/
|
||||
if (!pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs)) {
|
||||
free((void *) sc, M_DEVBUF);
|
||||
return;
|
||||
|
@ -86,10 +86,10 @@ ppbus_add_child(device_t dev, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
|
||||
/* allocate ivars for the new ppbus child */
|
||||
ppbdev = malloc(sizeof(struct ppb_device), M_PPBUSDEV, M_NOWAIT);
|
||||
ppbdev = malloc(sizeof(struct ppb_device), M_PPBUSDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!ppbdev)
|
||||
return NULL;
|
||||
bzero(ppbdev, sizeof *ppbdev);
|
||||
|
||||
/* initialize the ivars */
|
||||
ppbdev->name = name;
|
||||
|
@ -186,9 +186,7 @@ static void
|
||||
vpo_cam_rescan(struct vpo_data *vpo)
|
||||
{
|
||||
struct cam_path *path;
|
||||
union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK);
|
||||
|
||||
bzero(ccb, sizeof(union ccb));
|
||||
union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO);
|
||||
|
||||
if (xpt_create_path(&path, xpt_periph, cam_sim_path(vpo->sim), 0, 0)
|
||||
!= CAM_REQ_CMP) {
|
||||
|
@ -831,25 +831,24 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports)
|
||||
|
||||
bzero(rp, sizeof(struct rp_port) * num_ports);
|
||||
ctlp->tty = tty = (struct tty *)
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS, M_NOWAIT);
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if(tty == NULL) {
|
||||
device_printf(ctlp->dev, "rp_attachcommon: Could not malloc tty structures.\n");
|
||||
retval = ENOMEM;
|
||||
goto nogo;
|
||||
}
|
||||
bzero(tty, sizeof(struct tty) * num_ports);
|
||||
|
||||
oldspl = spltty();
|
||||
rp_addr(unit) = rp;
|
||||
splx(oldspl);
|
||||
|
||||
dev_nodes = ctlp->dev_nodes = malloc(sizeof(*(ctlp->dev_nodes)) * rp_num_ports[unit] * 6, M_DEVBUF, M_NOWAIT);
|
||||
dev_nodes = ctlp->dev_nodes = malloc(sizeof(*(ctlp->dev_nodes)) * rp_num_ports[unit] * 6, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if(ctlp->dev_nodes == NULL) {
|
||||
device_printf(ctlp->dev, "rp_attachcommon: Could not malloc device node structures.\n");
|
||||
retval = ENOMEM;
|
||||
goto nogo;
|
||||
}
|
||||
bzero(dev_nodes, sizeof(*(ctlp->dev_nodes)) * rp_num_ports[unit] * 6);
|
||||
|
||||
for (i = 0 ; i < rp_num_ports[unit] ; i++) {
|
||||
*(dev_nodes++) = make_dev(&rp_cdevsw, ((unit + 1) << 16) | i,
|
||||
|
@ -173,23 +173,20 @@ rp_probe(device_t dev)
|
||||
|
||||
/* The IO ports of AIOPs for an ISA controller are discrete. */
|
||||
ctlp->io_num = 1;
|
||||
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT);
|
||||
ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT);
|
||||
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
|
||||
device_printf(dev, "rp_attach: Out of memory.\n");
|
||||
retval = ENOMEM;
|
||||
goto nogo;
|
||||
}
|
||||
bzero(ctlp->io_rid, sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD);
|
||||
bzero(ctlp->io, sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD);
|
||||
|
||||
ctlp->bus_ctlp = malloc(sizeof(ISACONTROLLER_t) * 1, M_DEVBUF, M_NOWAIT);
|
||||
ctlp->bus_ctlp = malloc(sizeof(ISACONTROLLER_t) * 1, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ctlp->bus_ctlp == NULL) {
|
||||
device_printf(dev, "rp_attach: Out of memory.\n");
|
||||
retval = ENOMEM;
|
||||
goto nogo;
|
||||
}
|
||||
bzero(ctlp->bus_ctlp, sizeof(ISACONTROLLER_t) * 1);
|
||||
|
||||
ctlp->io_rid[0] = 0;
|
||||
if (rp_controller != NULL) {
|
||||
|
@ -165,15 +165,13 @@ rp_pciattach(device_t dev)
|
||||
|
||||
/* The IO ports of AIOPs for a PCI controller are continuous. */
|
||||
ctlp->io_num = 1;
|
||||
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT);
|
||||
ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT);
|
||||
ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
|
||||
device_printf(dev, "rp_pciattach: Out of memory.\n");
|
||||
retval = ENOMEM;
|
||||
goto nogo;
|
||||
}
|
||||
bzero(ctlp->io_rid, sizeof(*(ctlp->io_rid)) * ctlp->io_num);
|
||||
bzero(ctlp->io, sizeof(*(ctlp->io)) * ctlp->io_num);
|
||||
|
||||
ctlp->bus_ctlp = NULL;
|
||||
|
||||
|
@ -497,23 +497,22 @@ siattach(device_t dev)
|
||||
(maddr + (unsigned)(modp->sm_next & 0x7fff));
|
||||
}
|
||||
sc->sc_ports = (struct si_port *)malloc(sizeof(struct si_port) * nport,
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc->sc_ports == 0) {
|
||||
mem_fail:
|
||||
printf("si%d: fail to malloc memory for port structs\n",
|
||||
unit);
|
||||
return EINVAL;
|
||||
}
|
||||
bzero(sc->sc_ports, sizeof(struct si_port) * nport);
|
||||
sc->sc_nport = nport;
|
||||
|
||||
/*
|
||||
* allocate tty structures for ports
|
||||
*/
|
||||
tp = (struct tty *)malloc(sizeof(*tp) * nport, M_DEVBUF, M_NOWAIT);
|
||||
tp = (struct tty *)malloc(sizeof(*tp) * nport, M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (tp == 0)
|
||||
goto mem_fail;
|
||||
bzero(tp, sizeof(*tp) * nport);
|
||||
si__tty = tp;
|
||||
|
||||
/*
|
||||
|
@ -291,8 +291,7 @@ snpopen(dev, flag, mode, p)
|
||||
if (dev->si_drv1 == NULL) {
|
||||
int mynor = minor(dev);
|
||||
|
||||
dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK);
|
||||
bzero(snp, sizeof(*snp));
|
||||
dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK|M_ZERO);
|
||||
make_dev(&snp_cdevsw, mynor, 0, 0, 0600, "snp%d", mynor);
|
||||
} else
|
||||
return (EBUSY);
|
||||
|
@ -659,10 +659,10 @@ srattach_isa(struct isa_device *id)
|
||||
* Allocate the software interface table(s)
|
||||
*/
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
hc->numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
hc->numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL)
|
||||
return(0);
|
||||
bzero(hc->sc, hc->numports * sizeof(struct sr_softc));
|
||||
|
||||
id->id_ointr = srintr;
|
||||
|
||||
@ -768,18 +768,16 @@ srattach_pci(int unit, vm_offset_t plx_vaddr, vm_offset_t sca_vaddr)
|
||||
hc = hc->next;
|
||||
}
|
||||
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc == NULL)
|
||||
return NULL;
|
||||
bzero(hc, sizeof(*hc));
|
||||
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc->sc, struct sr_softc *, numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL) {
|
||||
FREE(hc, M_DEVBUF);
|
||||
return NULL;
|
||||
}
|
||||
bzero(hc->sc, numports * sizeof(struct sr_softc));
|
||||
*hcp = hc;
|
||||
|
||||
hc->numports = numports;
|
||||
@ -3188,12 +3186,11 @@ ngsr_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -659,10 +659,10 @@ srattach_isa(struct isa_device *id)
|
||||
* Allocate the software interface table(s)
|
||||
*/
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
hc->numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
hc->numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL)
|
||||
return(0);
|
||||
bzero(hc->sc, hc->numports * sizeof(struct sr_softc));
|
||||
|
||||
id->id_ointr = srintr;
|
||||
|
||||
@ -768,18 +768,16 @@ srattach_pci(int unit, vm_offset_t plx_vaddr, vm_offset_t sca_vaddr)
|
||||
hc = hc->next;
|
||||
}
|
||||
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc == NULL)
|
||||
return NULL;
|
||||
bzero(hc, sizeof(*hc));
|
||||
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc->sc, struct sr_softc *, numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL) {
|
||||
FREE(hc, M_DEVBUF);
|
||||
return NULL;
|
||||
}
|
||||
bzero(hc->sc, numports * sizeof(struct sr_softc));
|
||||
*hcp = hc;
|
||||
|
||||
hc->numports = numports;
|
||||
@ -3188,12 +3186,11 @@ ngsr_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -2541,8 +2541,7 @@ scinit(int unit, int flags)
|
||||
kernel_default.rev_color);
|
||||
} else {
|
||||
/* assert(sc_malloc) */
|
||||
sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK);
|
||||
bzero(sc->dev, sizeof(dev_t)*sc->vtys);
|
||||
sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS);
|
||||
sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty);
|
||||
scp = alloc_scp(sc, sc->first_vty);
|
||||
|
@ -747,13 +747,12 @@ epic_common_attach(sc)
|
||||
i = sizeof(struct epic_frag_list)*TX_RING_SIZE +
|
||||
sizeof(struct epic_rx_desc)*RX_RING_SIZE +
|
||||
sizeof(struct epic_tx_desc)*TX_RING_SIZE + PAGE_SIZE,
|
||||
sc->pool = (epic_softc_t *) malloc( i, M_DEVBUF, M_NOWAIT);
|
||||
sc->pool = (epic_softc_t *) malloc(i, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
|
||||
if (sc->pool == NULL) {
|
||||
printf(": can't allocate memory for buffers\n");
|
||||
return -1;
|
||||
}
|
||||
bzero(sc->pool, i);
|
||||
|
||||
/* Align pool on PAGE_SIZE */
|
||||
pool = (caddr_t)sc->pool;
|
||||
|
@ -182,10 +182,9 @@ vnfindvn(dev_t dev)
|
||||
}
|
||||
}
|
||||
if (!vn) {
|
||||
vn = malloc(sizeof *vn, M_DEVBUF, M_WAITOK);
|
||||
vn = malloc(sizeof *vn, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (!vn)
|
||||
return (NULL);
|
||||
bzero(vn, sizeof *vn);
|
||||
vn->sc_unit = unit;
|
||||
dev->si_drv1 = vn;
|
||||
make_dev(&vn_cdevsw,
|
||||
|
@ -401,8 +401,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
pri_sierra->root_directory_record:
|
||||
pri->root_directory_record);
|
||||
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
|
||||
bzero((caddr_t)isomp, sizeof *isomp);
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO);
|
||||
isomp->logical_block_size = logical_block_size;
|
||||
isomp->volume_space_size =
|
||||
isonum_733 (high_sierra?
|
||||
@ -723,8 +722,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
|
||||
return (error);
|
||||
}
|
||||
MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE,
|
||||
M_WAITOK);
|
||||
bzero((caddr_t)ip, sizeof(struct iso_node));
|
||||
M_WAITOK | M_ZERO);
|
||||
lockinit(&vp->v_lock, PINOD, "isonode", 0, 0);
|
||||
/*
|
||||
* ISOFS uses stdlock and can share lock structure
|
||||
|
@ -149,15 +149,13 @@ devfs_attemptoverflow(int insist)
|
||||
or = NULL;
|
||||
n = devfs_noverflowwant;
|
||||
nb = sizeof (struct dev_t *) * n;
|
||||
MALLOC(ot, dev_t **, nb, M_DEVFS, insist ? M_WAITOK : M_NOWAIT);
|
||||
MALLOC(ot, dev_t **, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
||||
if (ot == NULL)
|
||||
goto bail;
|
||||
bzero(ot, nb);
|
||||
nb = sizeof (int) * n;
|
||||
MALLOC(or, int *, nb, M_DEVFS, insist ? M_WAITOK : M_NOWAIT);
|
||||
MALLOC(or, int *, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
||||
if (or == NULL)
|
||||
goto bail;
|
||||
bzero(or, nb);
|
||||
if (!atomic_cmpset_ptr(&devfs_overflow, NULL, ot))
|
||||
goto bail;
|
||||
devfs_refoverflow = or;
|
||||
@ -198,8 +196,7 @@ devfs_newdirent(char *name, int namelen)
|
||||
|
||||
d.d_namlen = namelen;
|
||||
i = sizeof (*de) + GENERIC_DIRSIZ(&d);
|
||||
MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_WAITOK);
|
||||
bzero(de, i);
|
||||
MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_WAITOK | M_ZERO);
|
||||
de->de_dirent = (struct dirent *)(de + 1);
|
||||
de->de_dirent->d_namlen = namelen;
|
||||
de->de_dirent->d_reclen = GENERIC_DIRSIZ(&d);
|
||||
@ -287,8 +284,7 @@ devfs_populate(struct devfs_mount *dm)
|
||||
if (devfs_noverflow && dm->dm_overflow == NULL) {
|
||||
i = devfs_noverflow * sizeof (struct devfs_dirent *);
|
||||
MALLOC(dm->dm_overflow, struct devfs_dirent **, i,
|
||||
M_DEVFS, M_WAITOK);
|
||||
bzero(dm->dm_overflow, i);
|
||||
M_DEVFS, M_WAITOK | M_ZERO);
|
||||
}
|
||||
while (dm->dm_generation != devfs_generation) {
|
||||
dm->dm_generation = devfs_generation;
|
||||
|
@ -79,8 +79,7 @@ devfs_mount(mp, path, data, ndp, p)
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
MALLOC(fmp, struct devfs_mount *, sizeof(struct devfs_mount),
|
||||
M_DEVFS, M_WAITOK);
|
||||
bzero(fmp, sizeof(*fmp));
|
||||
M_DEVFS, M_WAITOK | M_ZERO);
|
||||
lockinit(&fmp->dm_lock, PVFS, "devfs", 0, LK_NOPAUSE);
|
||||
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
|
@ -371,8 +371,7 @@ hpfs_mountfs(devvp, mp, argsp, p)
|
||||
/*
|
||||
* Do actual mount
|
||||
*/
|
||||
hpmp = malloc(sizeof(struct hpfsmount), M_HPFSMNT, M_WAITOK);
|
||||
bzero(hpmp, sizeof(struct hpfsmount));
|
||||
hpmp = malloc(sizeof(struct hpfsmount), M_HPFSMNT, M_WAITOK | M_ZERO);
|
||||
|
||||
/* Read in SuperBlock */
|
||||
error = bread(devvp, SUBLOCK, SUSIZE, NOCRED, &bp);
|
||||
|
@ -176,8 +176,7 @@ msdosfs_mountroot()
|
||||
if (bdevvp(rootdev, &rootvp))
|
||||
panic("msdosfs_mountroot: can't setup rootvp");
|
||||
|
||||
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
|
||||
bzero((char *)mp, (u_long)sizeof(struct mount));
|
||||
mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO);
|
||||
mp->mnt_op = &msdosfs_vfsops;
|
||||
mp->mnt_flag = 0;
|
||||
LIST_INIT(&mp->mnt_vnodelist);
|
||||
@ -464,8 +463,7 @@ mountmsdosfs(devvp, mp, p, argp)
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
/*
|
||||
|
@ -394,10 +394,9 @@ ntfs_ntlookup(
|
||||
}
|
||||
} while (LOCKMGR(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL, NULL));
|
||||
|
||||
MALLOC(ip, struct ntnode *, sizeof(struct ntnode),
|
||||
M_NTFSNTNODE, M_WAITOK);
|
||||
MALLOC(ip, struct ntnode *, sizeof(struct ntnode), M_NTFSNTNODE,
|
||||
M_WAITOK | M_ZERO);
|
||||
ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip));
|
||||
bzero((caddr_t) ip, sizeof(struct ntnode));
|
||||
|
||||
/* Generic initialization */
|
||||
ip->i_devvp = ntmp->ntm_devvp;
|
||||
@ -544,8 +543,7 @@ ntfs_attrtontvattr(
|
||||
*rvapp = NULL;
|
||||
|
||||
MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr),
|
||||
M_NTFSNTVATTR, M_WAITOK);
|
||||
bzero(vap, sizeof(struct ntvattr));
|
||||
M_NTFSNTVATTR, M_WAITOK | M_ZERO);
|
||||
vap->va_ip = NULL;
|
||||
vap->va_flag = rap->a_hdr.a_flag;
|
||||
vap->va_type = rap->a_hdr.a_type;
|
||||
@ -737,8 +735,8 @@ ntfs_fget(
|
||||
if (*fpp)
|
||||
return (0);
|
||||
|
||||
MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE, M_WAITOK);
|
||||
bzero(fp, sizeof(struct fnode));
|
||||
MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE,
|
||||
M_WAITOK | M_ZERO);
|
||||
dprintf(("ntfs_fget: allocating fnode: %p\n",fp));
|
||||
|
||||
fp->f_ip = ip;
|
||||
|
@ -478,8 +478,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;
|
||||
|
@ -179,9 +179,7 @@ union_mount(mp, path, data, ndp, p)
|
||||
*/
|
||||
|
||||
um = (struct union_mount *) malloc(sizeof(struct union_mount),
|
||||
M_UNIONFSMNT, M_WAITOK);
|
||||
|
||||
bzero(um, sizeof(struct union_mount));
|
||||
M_UNIONFSMNT, M_WAITOK | M_ZERO);
|
||||
|
||||
um->um_op = args.mntflags & UNMNT_OPMASK;
|
||||
|
||||
|
@ -598,8 +598,8 @@ ccdinterleave(cs, unit)
|
||||
* Chances are this is too big, but we don't care.
|
||||
*/
|
||||
size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo);
|
||||
cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF, M_WAITOK);
|
||||
bzero((caddr_t)cs->sc_itable, size);
|
||||
cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
|
||||
/*
|
||||
* Trivial case: no interleave (actually interleave of disk size).
|
||||
|
@ -250,14 +250,13 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
|
||||
int maxpages;
|
||||
|
||||
*mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
if (*mapp == NULL) {
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (*mapp == NULL)
|
||||
return (ENOMEM);
|
||||
} else {
|
||||
/* Initialize the new map */
|
||||
bzero(*mapp, sizeof(**mapp));
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
}
|
||||
|
||||
/* Initialize the new map */
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
|
||||
/*
|
||||
* Attempt to add pages to our pool on a per-instance
|
||||
* basis up to a sane limit.
|
||||
@ -551,11 +550,10 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
|
||||
int s;
|
||||
|
||||
bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
|
||||
if (bpage == NULL)
|
||||
break;
|
||||
bzero(bpage, sizeof(*bpage));
|
||||
bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF,
|
||||
M_NOWAIT, 0ul,
|
||||
dmat->lowaddr,
|
||||
|
@ -522,8 +522,7 @@ i686_mrinit(struct mem_range_softc *sc)
|
||||
|
||||
sc->mr_desc =
|
||||
(struct mem_range_desc *)malloc(nmdesc * sizeof(struct mem_range_desc),
|
||||
M_MEMDESC, M_WAITOK);
|
||||
bzero(sc->mr_desc, nmdesc * sizeof(struct mem_range_desc));
|
||||
M_MEMDESC, M_WAITOK | M_ZERO);
|
||||
sc->mr_ndesc = nmdesc;
|
||||
|
||||
mrd = sc->mr_desc;
|
||||
|
@ -100,10 +100,9 @@ k6_mrinit(struct mem_range_softc *sc) {
|
||||
sc->mr_cap = 0;
|
||||
sc->mr_ndesc = 2; /* XXX (BFF) For now, we only have one msr for this */
|
||||
sc->mr_desc = malloc(sc->mr_ndesc * sizeof(struct mem_range_desc),
|
||||
M_MEMDESC, M_NOWAIT);
|
||||
M_MEMDESC, M_NOWAIT | M_ZERO);
|
||||
if (sc->mr_desc == NULL)
|
||||
panic("k6_mrinit: malloc returns NULL");
|
||||
bzero(sc->mr_desc, sc->mr_ndesc * sizeof(struct mem_range_desc));
|
||||
|
||||
reg = rdmsr(UWCCR);
|
||||
for (d = 0; d < sc->mr_ndesc; d++) {
|
||||
|
@ -331,10 +331,9 @@ nexus_add_child(device_t bus, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
struct nexus_device *ndev;
|
||||
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT);
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
|
||||
if (!ndev)
|
||||
return(0);
|
||||
bzero(ndev, sizeof(struct nexus_device));
|
||||
resource_list_init(&ndev->nx_resources);
|
||||
ndev->nx_pcibus = -1;
|
||||
|
||||
|
@ -331,10 +331,9 @@ nexus_add_child(device_t bus, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
struct nexus_device *ndev;
|
||||
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT);
|
||||
ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
|
||||
if (!ndev)
|
||||
return(0);
|
||||
bzero(ndev, sizeof(struct nexus_device));
|
||||
resource_list_init(&ndev->nx_resources);
|
||||
ndev->nx_pcibus = -1;
|
||||
|
||||
|
@ -3228,8 +3228,8 @@ load_devtab(void)
|
||||
char *name;
|
||||
int unit;
|
||||
|
||||
uc_devtab = malloc(sizeof(struct uc_device)*(count + 1),M_DEVL,M_WAITOK);
|
||||
bzero(uc_devtab, sizeof(struct uc_device) * (count + 1));
|
||||
uc_devtab = malloc(sizeof(struct uc_device) * (count + 1), M_DEVL,
|
||||
M_WAITOK | M_ZERO);
|
||||
dt = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
name = resource_query_name(i);
|
||||
|
@ -287,11 +287,10 @@ cpu_coredump(p, vp, cred)
|
||||
int error;
|
||||
caddr_t tempuser;
|
||||
|
||||
tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK);
|
||||
tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK | M_ZERO);
|
||||
if (!tempuser)
|
||||
return EINVAL;
|
||||
|
||||
bzero(tempuser, ctob(UPAGES));
|
||||
bcopy(p->p_addr, tempuser, sizeof(struct user));
|
||||
bcopy(p->p_md.md_regs,
|
||||
tempuser + ((caddr_t) p->p_md.md_regs - (caddr_t) p->p_addr),
|
||||
|
@ -682,15 +682,13 @@ bs_init_target_info(bsc, target)
|
||||
{
|
||||
struct targ_info *ti;
|
||||
|
||||
ti = malloc(sizeof(struct targ_info), M_DEVBUF, M_NOWAIT);
|
||||
ti = malloc(sizeof(struct targ_info), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ti == NULL)
|
||||
{
|
||||
bs_printf(NULL, "bs_init_targ_info", "no target info memory");
|
||||
return ti;
|
||||
}
|
||||
|
||||
bzero(ti, sizeof(*ti));
|
||||
|
||||
ti->ti_bsc = bsc;
|
||||
ti->ti_id = target;
|
||||
ti->sm_offset = 0;
|
||||
|
@ -153,11 +153,11 @@ bsprobe(dev)
|
||||
printf("bs%d: memory already allocated\n", unit);
|
||||
return rv;
|
||||
}
|
||||
if (!(bsc = malloc(sizeof(struct bs_softc), M_TEMP, M_NOWAIT))) {
|
||||
if (!(bsc = malloc(sizeof(struct bs_softc), M_TEMP, M_NOWAIT | M_ZERO)))
|
||||
{
|
||||
printf("bs%d cannot malloc!\n", unit);
|
||||
return rv;
|
||||
}
|
||||
bzero(bsc, sizeof(struct bs_softc));
|
||||
callout_handle_init(&bsc->timeout_ch);
|
||||
bscdata[unit] = bsc;
|
||||
bsc->unit = unit;
|
||||
|
@ -553,10 +553,9 @@ cyattach_common(cy_iobase, cy_align)
|
||||
struct com_s *com;
|
||||
int s;
|
||||
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT);
|
||||
com = malloc(sizeof *com, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (com == NULL)
|
||||
break;
|
||||
bzero(com, sizeof *com);
|
||||
com->unit = unit;
|
||||
com->gfrcr_image = firmware_version;
|
||||
if (CY_RTS_DTR_SWAPPED(firmware_version)) {
|
||||
|
@ -397,8 +397,7 @@ arattach_pci(int unit, vm_offset_t mem_addr)
|
||||
struct ar_hardc *hc;
|
||||
u_int i, tmp;
|
||||
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK);
|
||||
bzero(hc, sizeof(struct ar_hardc));
|
||||
hc = malloc(sizeof(struct ar_hardc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
hc->cunit = unit;
|
||||
hc->mem_start = (caddr_t)mem_addr;
|
||||
@ -1139,11 +1138,10 @@ arc_init(struct ar_hardc *hc)
|
||||
u_int descneeded;
|
||||
u_char isr, mar;
|
||||
|
||||
MALLOC(sc, struct ar_softc *,
|
||||
hc->numports * sizeof(struct ar_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
bzero(sc, hc->numports * sizeof(struct ar_softc));
|
||||
hc->sc = sc;
|
||||
|
||||
hc->txc_dtr[0] = AR_TXC_DTR_NOTRESET |
|
||||
@ -2234,12 +2232,11 @@ ngar_rcvmsg(node_p node, struct ng_mesg *msg,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -659,10 +659,10 @@ srattach_isa(struct isa_device *id)
|
||||
* Allocate the software interface table(s)
|
||||
*/
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
hc->numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
hc->numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL)
|
||||
return(0);
|
||||
bzero(hc->sc, hc->numports * sizeof(struct sr_softc));
|
||||
|
||||
id->id_ointr = srintr;
|
||||
|
||||
@ -768,18 +768,16 @@ srattach_pci(int unit, vm_offset_t plx_vaddr, vm_offset_t sca_vaddr)
|
||||
hc = hc->next;
|
||||
}
|
||||
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc, struct sr_hardc *, sizeof(*hc), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc == NULL)
|
||||
return NULL;
|
||||
bzero(hc, sizeof(*hc));
|
||||
|
||||
MALLOC(hc->sc, struct sr_softc *,
|
||||
numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK);
|
||||
MALLOC(hc->sc, struct sr_softc *, numports * sizeof(struct sr_softc),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (hc->sc == NULL) {
|
||||
FREE(hc, M_DEVBUF);
|
||||
return NULL;
|
||||
}
|
||||
bzero(hc->sc, numports * sizeof(struct sr_softc));
|
||||
*hcp = hc;
|
||||
|
||||
hc->numports = numports;
|
||||
@ -3188,12 +3186,11 @@ ngsr_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
|
||||
int pos = 0;
|
||||
int resplen = sizeof(struct ng_mesg) + 512;
|
||||
MALLOC(*resp, struct ng_mesg *, resplen,
|
||||
M_NETGRAPH, M_NOWAIT);
|
||||
M_NETGRAPH, M_NOWAIT | M_ZERO);
|
||||
if (*resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
bzero(*resp, resplen);
|
||||
arg = (*resp)->data;
|
||||
|
||||
/*
|
||||
|
@ -546,10 +546,10 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
if (ithd == NULL || ithd->it_ih == NULL) {
|
||||
/* first handler for this irq. */
|
||||
if (ithd == NULL) {
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF, M_WAITOK);
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (ithd == NULL)
|
||||
return (NULL);
|
||||
bzero(ithd, sizeof(struct ithd));
|
||||
ithd->irq = irq;
|
||||
ithds[irq] = ithd;
|
||||
}
|
||||
@ -620,10 +620,9 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
else
|
||||
strcat(p->p_comm, "+");
|
||||
}
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK);
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (idesc == NULL)
|
||||
return (NULL);
|
||||
bzero(idesc, sizeof (struct intrhand));
|
||||
|
||||
idesc->ih_handler = handler;
|
||||
idesc->ih_argument = arg;
|
||||
|
@ -269,10 +269,9 @@ compat_isa_handler(module_t mod, int type, void *data)
|
||||
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT);
|
||||
driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (!driver)
|
||||
return ENOMEM;
|
||||
bzero(driver, sizeof(driver_t));
|
||||
driver->name = id->name;
|
||||
driver->methods = isa_compat_methods;
|
||||
driver->size = sizeof(struct isa_device);
|
||||
|
@ -666,13 +666,12 @@ static stlibrd_t *stli_brdalloc(void)
|
||||
{
|
||||
stlibrd_t *brdp;
|
||||
|
||||
brdp = (stlibrd_t *) malloc(sizeof(stlibrd_t), M_TTYS, M_NOWAIT);
|
||||
brdp = (stlibrd_t *) malloc(sizeof(stlibrd_t), M_TTYS, M_NOWAIT|M_ZERO);
|
||||
if (brdp == (stlibrd_t *) NULL) {
|
||||
printf("STALLION: failed to allocate memory (size=%d)\n",
|
||||
sizeof(stlibrd_t));
|
||||
return((stlibrd_t *) NULL);
|
||||
}
|
||||
bzero(brdp, sizeof(stlibrd_t));
|
||||
return(brdp);
|
||||
}
|
||||
|
||||
@ -2513,12 +2512,11 @@ static int stli_initports(stlibrd_t *brdp)
|
||||
|
||||
for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
|
||||
portp = (stliport_t *) malloc(sizeof(stliport_t), M_TTYS,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (portp == (stliport_t *) NULL) {
|
||||
printf("STALLION: failed to allocate port structure\n");
|
||||
continue;
|
||||
}
|
||||
bzero(portp, sizeof(stliport_t));
|
||||
|
||||
portp->portnr = i;
|
||||
portp->brdnr = brdp->brdnr;
|
||||
|
@ -546,10 +546,10 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
if (ithd == NULL || ithd->it_ih == NULL) {
|
||||
/* first handler for this irq. */
|
||||
if (ithd == NULL) {
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF, M_WAITOK);
|
||||
ithd = malloc(sizeof (struct ithd), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
if (ithd == NULL)
|
||||
return (NULL);
|
||||
bzero(ithd, sizeof(struct ithd));
|
||||
ithd->irq = irq;
|
||||
ithds[irq] = ithd;
|
||||
}
|
||||
@ -620,10 +620,9 @@ inthand_add(const char *name, int irq, driver_intr_t handler, void *arg,
|
||||
else
|
||||
strcat(p->p_comm, "+");
|
||||
}
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK);
|
||||
idesc = malloc(sizeof (struct intrhand), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (idesc == NULL)
|
||||
return (NULL);
|
||||
bzero(idesc, sizeof (struct intrhand));
|
||||
|
||||
idesc->ih_handler = handler;
|
||||
idesc->ih_argument = arg;
|
||||
|
@ -1109,7 +1109,7 @@ rp_pciattach(pcici_t tag, int unit)
|
||||
rp_num_ports[unit] = num_ports;
|
||||
|
||||
rp = (struct rp_port *)
|
||||
malloc(sizeof(struct rp_port) * num_ports, M_TTYS, M_NOWAIT);
|
||||
malloc(sizeof(struct rp_port) * num_ports, M_TTYS, M_NOWAIT|M_ZERO);
|
||||
if(rp == 0) {
|
||||
printf("rp_attach: Could not malloc rp_ports structures\n");
|
||||
return;
|
||||
@ -1119,14 +1119,12 @@ rp_pciattach(pcici_t tag, int unit)
|
||||
for(i=count;i < (count + rp_num_ports[unit]);i++)
|
||||
minor_to_unit[i] = unit;
|
||||
|
||||
bzero(rp, sizeof(struct rp_port) * num_ports);
|
||||
tty = (struct tty *)
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS, M_NOWAIT);
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS, M_NOWAIT|M_ZERO);
|
||||
if(tty == 0) {
|
||||
printf("rp_attach: Could not malloc tty structures\n");
|
||||
return;
|
||||
}
|
||||
bzero(tty, sizeof(struct tty) * num_ports);
|
||||
|
||||
oldspl = spltty();
|
||||
rp_addr(unit) = rp;
|
||||
@ -1212,7 +1210,7 @@ struct isa_device *dev;
|
||||
rp_num_ports[unit] = num_ports;
|
||||
|
||||
rp = (struct rp_port *)
|
||||
malloc(sizeof(struct rp_port) * num_ports, M_TTYS, M_NOWAIT);
|
||||
malloc(sizeof(struct rp_port) * num_ports, M_TTYS, M_NOWAIT|M_ZERO);
|
||||
if(rp == 0) {
|
||||
printf("rp_attach: Could not malloc rp_ports structures\n");
|
||||
return(0);
|
||||
@ -1222,14 +1220,12 @@ struct isa_device *dev;
|
||||
for(i=count;i < (count + rp_num_ports[unit]);i++)
|
||||
minor_to_unit[i] = unit;
|
||||
|
||||
bzero(rp, sizeof(struct rp_port) * num_ports);
|
||||
tty = (struct tty *)
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS, M_NOWAIT);
|
||||
malloc(sizeof(struct tty) * num_ports, M_TTYS, M_NOWAIT|M_ZERO);
|
||||
if(tty == 0) {
|
||||
printf("rp_attach: Could not malloc tty structures\n");
|
||||
return(0);
|
||||
}
|
||||
bzero(tty, sizeof(struct tty) * num_ports);
|
||||
|
||||
oldspl = spltty();
|
||||
rp_addr(unit) = rp;
|
||||
|
@ -635,13 +635,12 @@ static int stlattach(struct isa_device *idp)
|
||||
|
||||
idp->id_ointr = stlintr;
|
||||
|
||||
brdp = (stlbrd_t *) malloc(sizeof(stlbrd_t), M_TTYS, M_NOWAIT);
|
||||
brdp = (stlbrd_t *) malloc(sizeof(stlbrd_t), M_TTYS, M_NOWAIT | M_ZERO);
|
||||
if (brdp == (stlbrd_t *) NULL) {
|
||||
printf("STALLION: failed to allocate memory (size=%d)\n",
|
||||
sizeof(stlbrd_t));
|
||||
return(0);
|
||||
}
|
||||
bzero(brdp, sizeof(stlbrd_t));
|
||||
|
||||
if ((brdp->brdnr = stl_findfreeunit()) < 0) {
|
||||
printf("STALLION: too many boards found, max=%d\n",
|
||||
@ -707,13 +706,12 @@ void stlpciattach(pcici_t tag, int unit)
|
||||
printf("stlpciattach(tag=%x,unit=%x)\n", (int) &tag, unit);
|
||||
#endif
|
||||
|
||||
brdp = (stlbrd_t *) malloc(sizeof(stlbrd_t), M_TTYS, M_NOWAIT);
|
||||
brdp = (stlbrd_t *) malloc(sizeof(stlbrd_t), M_TTYS, M_NOWAIT | M_ZERO);
|
||||
if (brdp == (stlbrd_t *) NULL) {
|
||||
printf("STALLION: failed to allocate memory (size=%d)\n",
|
||||
sizeof(stlbrd_t));
|
||||
return;
|
||||
}
|
||||
bzero(brdp, sizeof(stlbrd_t));
|
||||
|
||||
if ((unit < 0) || (unit > STL_MAXBRDS)) {
|
||||
printf("STALLION: bad PCI board unit number=%d\n", unit);
|
||||
@ -2596,13 +2594,12 @@ static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp)
|
||||
if ((chipmask & (0x1 << (i / 4))) == 0)
|
||||
continue;
|
||||
portp = (stlport_t *) malloc(sizeof(stlport_t), M_TTYS,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (portp == (stlport_t *) NULL) {
|
||||
printf("STALLION: failed to allocate port memory "
|
||||
"(size=%d)\n", sizeof(stlport_t));
|
||||
break;
|
||||
}
|
||||
bzero(portp, sizeof(stlport_t));
|
||||
|
||||
portp->portnr = i;
|
||||
portp->brdnr = panelp->brdnr;
|
||||
@ -2701,13 +2698,13 @@ static int stl_initeio(stlbrd_t *brdp)
|
||||
outb(brdp->ioctrl, (stl_vecmap[brdp->irq] |
|
||||
((brdp->irqtype) ? EIO_INTLEVEL : EIO_INTEDGE)));
|
||||
|
||||
panelp = (stlpanel_t *) malloc(sizeof(stlpanel_t), M_TTYS, M_NOWAIT);
|
||||
panelp = (stlpanel_t *) malloc(sizeof(stlpanel_t), M_TTYS,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (panelp == (stlpanel_t *) NULL) {
|
||||
printf("STALLION: failed to allocate memory (size=%d)\n",
|
||||
sizeof(stlpanel_t));
|
||||
return(ENOMEM);
|
||||
}
|
||||
bzero(panelp, sizeof(stlpanel_t));
|
||||
|
||||
panelp->brdnr = brdp->brdnr;
|
||||
panelp->panelnr = 0;
|
||||
@ -2803,13 +2800,12 @@ static int stl_initech(stlbrd_t *brdp)
|
||||
if ((status & ECH_PNLIDMASK) != nxtid)
|
||||
break;
|
||||
panelp = (stlpanel_t *) malloc(sizeof(stlpanel_t), M_TTYS,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (panelp == (stlpanel_t *) NULL) {
|
||||
printf("STALLION: failed to allocate memory"
|
||||
"(size=%d)\n", sizeof(stlpanel_t));
|
||||
break;
|
||||
}
|
||||
bzero(panelp, sizeof(stlpanel_t));
|
||||
panelp->brdnr = brdp->brdnr;
|
||||
panelp->panelnr = panelnr;
|
||||
panelp->iobase = ioaddr;
|
||||
|
@ -243,23 +243,20 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
|
||||
|
||||
if (dmat->flags & BUS_DMA_ISA) {
|
||||
bus_dmamap_t map;
|
||||
map = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
if (map == NULL) {
|
||||
map = (bus_dmamap_t)malloc(sizeof(*map), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (map == NULL)
|
||||
return (ENOMEM);
|
||||
} else {
|
||||
bzero(map, sizeof(*map));
|
||||
#if 0
|
||||
map->busaddress =
|
||||
sgmap_alloc_region(chipset.sgmap,
|
||||
dmat->maxsize,
|
||||
dmat->boundary,
|
||||
&map->sgmaphandle);
|
||||
map->busaddress =
|
||||
sgmap_alloc_region(chipset.sgmap,
|
||||
dmat->maxsize,
|
||||
dmat->boundary,
|
||||
&map->sgmaphandle);
|
||||
#endif
|
||||
dmat->map_count++;
|
||||
*mapp = map;
|
||||
return (0);
|
||||
}
|
||||
dmat->map_count++;
|
||||
*mapp = map;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (dmat->lowaddr < ptoa(Maxmem)) {
|
||||
@ -267,14 +264,13 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
|
||||
int maxpages;
|
||||
|
||||
*mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
if (*mapp == NULL) {
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (*mapp == NULL)
|
||||
return (ENOMEM);
|
||||
} else {
|
||||
/* Initialize the new map */
|
||||
bzero(*mapp, sizeof(**mapp));
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
}
|
||||
|
||||
/* Initialize the new map */
|
||||
STAILQ_INIT(&((*mapp)->bpages));
|
||||
|
||||
/*
|
||||
* Attempt to add pages to our pool on a per-instance
|
||||
* basis up to a sane limit.
|
||||
@ -606,11 +602,10 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
|
||||
int s;
|
||||
|
||||
bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF,
|
||||
M_NOWAIT);
|
||||
M_NOWAIT | M_ZERO);
|
||||
|
||||
if (bpage == NULL)
|
||||
break;
|
||||
bzero(bpage, sizeof(*bpage));
|
||||
bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF,
|
||||
M_NOWAIT, 0ul,
|
||||
dmat->lowaddr,
|
||||
|
@ -242,8 +242,7 @@ ssccreate(int unit)
|
||||
if (sc->unit == unit)
|
||||
return (NULL);
|
||||
}
|
||||
MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_WAITOK);
|
||||
bzero(sc, sizeof(*sc));
|
||||
MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_WAITOK | M_ZERO);
|
||||
LIST_INSERT_HEAD(&ssc_softc_list, sc, list);
|
||||
sc->unit = unit;
|
||||
bioq_init(&sc->bio_queue);
|
||||
|
@ -146,10 +146,10 @@ atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
return;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
|
@ -818,10 +818,9 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
ivar = malloc(sizeof *ivar, M_DEVBUF /* XXX */, M_NOWAIT);
|
||||
ivar = malloc(sizeof *ivar, M_DEVBUF /* XXX */, M_NOWAIT | M_ZERO);
|
||||
if (ivar == NULL)
|
||||
return;
|
||||
bzero(ivar, sizeof *ivar);
|
||||
if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0)
|
||||
ivar->fdunit = 0;
|
||||
child = device_add_child(dev, name, unit);
|
||||
|
@ -522,10 +522,9 @@ isa_add_child(device_t dev, int order, const char *name, int unit)
|
||||
device_t child;
|
||||
struct isa_device *idev;
|
||||
|
||||
idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT);
|
||||
idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT | M_ZERO);
|
||||
if (!idev)
|
||||
return 0;
|
||||
bzero(idev, sizeof *idev);
|
||||
|
||||
resource_list_init(&idev->id_resources);
|
||||
TAILQ_INIT(&idev->id_configs);
|
||||
|
@ -62,12 +62,11 @@ pnp_parse_resources(device_t dev, u_char *resources, int len, u_int32_t vendor_i
|
||||
|
||||
id = isa_get_logicalid(dev);
|
||||
configs = (struct isa_config *)malloc(sizeof(*configs) * (1 + MAXDEP),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (configs == NULL) {
|
||||
device_printf(dev, "No memory to parse PNP data\n");
|
||||
return;
|
||||
}
|
||||
bzero(configs, sizeof(*configs) * (1 + MAXDEP));
|
||||
config = &configs[0];
|
||||
priorities[0] = 0;
|
||||
resp = resources;
|
||||
|
@ -401,8 +401,7 @@ iso_mountfs(devvp, mp, p, argp)
|
||||
pri_sierra->root_directory_record:
|
||||
pri->root_directory_record);
|
||||
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
|
||||
bzero((caddr_t)isomp, sizeof *isomp);
|
||||
isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO);
|
||||
isomp->logical_block_size = logical_block_size;
|
||||
isomp->volume_space_size =
|
||||
isonum_733 (high_sierra?
|
||||
@ -723,8 +722,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
|
||||
return (error);
|
||||
}
|
||||
MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE,
|
||||
M_WAITOK);
|
||||
bzero((caddr_t)ip, sizeof(struct iso_node));
|
||||
M_WAITOK | M_ZERO);
|
||||
lockinit(&vp->v_lock, PINOD, "isonode", 0, 0);
|
||||
/*
|
||||
* ISOFS uses stdlock and can share lock structure
|
||||
|
@ -170,8 +170,7 @@ allocdev(void)
|
||||
|
||||
if (stashed >= DEVT_STASH) {
|
||||
MALLOC(si, struct specinfo *, sizeof(*si), M_DEVT,
|
||||
M_USE_RESERVE);
|
||||
bzero(si, sizeof(*si));
|
||||
M_USE_RESERVE | M_ZERO);
|
||||
} else if (LIST_FIRST(&dev_free)) {
|
||||
si = LIST_FIRST(&dev_free);
|
||||
LIST_REMOVE(si, si_hash);
|
||||
|
@ -859,8 +859,7 @@ falloc(p, resultfp, resultfd)
|
||||
* the list of open files.
|
||||
*/
|
||||
nfiles++;
|
||||
MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK);
|
||||
bzero(fp, sizeof(struct file));
|
||||
MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK | M_ZERO);
|
||||
|
||||
/*
|
||||
* wait until after malloc (which may have blocked) returns before
|
||||
@ -915,8 +914,7 @@ fdinit(p)
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
|
||||
MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0),
|
||||
M_FILEDESC, M_WAITOK);
|
||||
bzero(newfdp, sizeof(struct filedesc0));
|
||||
M_FILEDESC, M_WAITOK | M_ZERO);
|
||||
newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
|
||||
if (newfdp->fd_fd.fd_cdir)
|
||||
VREF(newfdp->fd_fd.fd_cdir);
|
||||
|
@ -306,8 +306,7 @@ kqueue(struct proc *p, struct kqueue_args *uap)
|
||||
fp->f_flag = FREAD | FWRITE;
|
||||
fp->f_type = DTYPE_KQUEUE;
|
||||
fp->f_ops = &kqueueops;
|
||||
kq = malloc(sizeof(struct kqueue), M_TEMP, M_WAITOK);
|
||||
bzero(kq, sizeof(*kq));
|
||||
kq = malloc(sizeof(struct kqueue), M_TEMP, M_WAITOK | M_ZERO);
|
||||
TAILQ_INIT(&kq->kq_head);
|
||||
fp->f_data = (caddr_t)kq;
|
||||
p->p_retval[0] = fd;
|
||||
|
@ -64,8 +64,7 @@ jail(p, uap)
|
||||
return (error);
|
||||
if (j.version != 0)
|
||||
return (EINVAL);
|
||||
MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_WAITOK);
|
||||
bzero((caddr_t)pr, sizeof *pr);
|
||||
MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_WAITOK | M_ZERO);
|
||||
error = copyinstr(j.hostname, &pr->pr_host, sizeof pr->pr_host, 0);
|
||||
if (error)
|
||||
goto bail;
|
||||
|
@ -515,10 +515,9 @@ linker_file_add_dependancy(linker_file_t file, linker_file_t dep)
|
||||
linker_file_t* newdeps;
|
||||
|
||||
newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t*),
|
||||
M_LINKER, M_WAITOK);
|
||||
M_LINKER, M_WAITOK | M_ZERO);
|
||||
if (newdeps == NULL)
|
||||
return ENOMEM;
|
||||
bzero(newdeps, (file->ndeps + 1) * sizeof(linker_file_t*));
|
||||
|
||||
if (file->deps) {
|
||||
bcopy(file->deps, newdeps, file->ndeps * sizeof(linker_file_t*));
|
||||
@ -589,12 +588,11 @@ linker_file_lookup_symbol(linker_file_t file, const char* name, int deps)
|
||||
cp = malloc(sizeof(struct common_symbol)
|
||||
+ common_size
|
||||
+ strlen(name) + 1,
|
||||
M_LINKER, M_WAITOK);
|
||||
M_LINKER, M_WAITOK | M_ZERO);
|
||||
if (!cp) {
|
||||
KLD_DPF(SYM, ("linker_file_lookup_symbol: nomem\n"));
|
||||
return 0;
|
||||
}
|
||||
bzero(cp, sizeof(struct common_symbol) + common_size + strlen(name)+ 1);
|
||||
|
||||
cp->address = (caddr_t) (cp + 1);
|
||||
cp->name = cp->address + common_size;
|
||||
@ -1021,10 +1019,9 @@ linker_preload(void* arg)
|
||||
/* XXX what can we do? this is a build error. :-( */
|
||||
continue;
|
||||
}
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT);
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT|M_ZERO);
|
||||
if (mod == NULL)
|
||||
panic("no memory for module list");
|
||||
bzero(mod, sizeof(*mod));
|
||||
mod->container = linker_kernel_file;
|
||||
mod->name = modname;
|
||||
TAILQ_INSERT_TAIL(&found_modules, mod, link);
|
||||
@ -1082,10 +1079,10 @@ linker_preload(void* arg)
|
||||
TAILQ_REMOVE(&loaded_files, lf, loaded);
|
||||
goto restart; /* we changed the tailq next ptr */
|
||||
}
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT);
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER,
|
||||
M_NOWAIT|M_ZERO);
|
||||
if (mod == NULL)
|
||||
panic("no memory for module list");
|
||||
bzero(mod, sizeof(*mod));
|
||||
mod->container = lf;
|
||||
mod->name = modname;
|
||||
TAILQ_INSERT_TAIL(&found_modules, mod, link);
|
||||
@ -1383,10 +1380,9 @@ linker_load_dependancies(linker_file_t lf)
|
||||
if (mp->md_type != MDT_VERSION)
|
||||
continue;
|
||||
modname = linker_reloc_ptr(lf, mp->md_cval);
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT);
|
||||
mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT|M_ZERO);
|
||||
if (mod == NULL)
|
||||
panic("no memory for module list");
|
||||
bzero(mod, sizeof(*mod));
|
||||
mod->container = lf;
|
||||
mod->name = modname;
|
||||
TAILQ_INSERT_TAIL(&found_modules, mod, link);
|
||||
|
@ -599,9 +599,9 @@ mtx_init(struct mtx *m, const char *t, int flag)
|
||||
#endif
|
||||
|
||||
/* XXX - should not use DEVBUF */
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF, M_NOWAIT);
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
MPASS(debug != NULL);
|
||||
bzero(debug, sizeof(struct mtx_debug));
|
||||
}
|
||||
#endif
|
||||
bzero((void *)m, sizeof *m);
|
||||
|
@ -339,8 +339,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent,
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK);
|
||||
bzero(oidp, sizeof(struct sysctl_oid));
|
||||
oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK|M_ZERO);
|
||||
oidp->oid_parent = parent;
|
||||
SLIST_NEXT(oidp, oid_link) = NULL;
|
||||
oidp->oid_number = number;
|
||||
|
@ -728,12 +728,11 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
|
||||
nbytes = hdr->e_shnum * hdr->e_shentsize;
|
||||
if (nbytes == 0 || hdr->e_shoff == 0)
|
||||
goto nosyms;
|
||||
shdr = malloc(nbytes, M_LINKER, M_WAITOK);
|
||||
shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO);
|
||||
if (shdr == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
bzero(shdr, nbytes);
|
||||
error = vn_rdwr(UIO_READ, nd.ni_vp,
|
||||
(caddr_t)shdr, nbytes, hdr->e_shoff,
|
||||
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
|
||||
|
@ -728,12 +728,11 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
|
||||
nbytes = hdr->e_shnum * hdr->e_shentsize;
|
||||
if (nbytes == 0 || hdr->e_shoff == 0)
|
||||
goto nosyms;
|
||||
shdr = malloc(nbytes, M_LINKER, M_WAITOK);
|
||||
shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO);
|
||||
if (shdr == NULL) {
|
||||
error = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
bzero(shdr, nbytes);
|
||||
error = vn_rdwr(UIO_READ, nd.ni_vp,
|
||||
(caddr_t)shdr, nbytes, hdr->e_shoff,
|
||||
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
|
||||
|
@ -152,9 +152,7 @@ blist_create(daddr_t blocks)
|
||||
skip = (skip + 1) << BLIST_META_RADIX_SHIFT;
|
||||
}
|
||||
|
||||
bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK);
|
||||
|
||||
bzero(bl, sizeof(*bl));
|
||||
bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK | M_ZERO);
|
||||
|
||||
bl->bl_blocks = blocks;
|
||||
bl->bl_radix = radix;
|
||||
|
@ -125,10 +125,9 @@ devclass_find_internal(const char *classname, int create)
|
||||
PDEBUG(("%s not found%s", classname, (create? ", creating": "")));
|
||||
if (create) {
|
||||
dc = malloc(sizeof(struct devclass) + strlen(classname) + 1,
|
||||
M_BUS, M_NOWAIT);
|
||||
M_BUS, M_NOWAIT|M_ZERO);
|
||||
if (!dc)
|
||||
return NULL;
|
||||
bzero(dc, sizeof(struct devclass) + strlen(classname) + 1);
|
||||
dc->name = (char*) (dc + 1);
|
||||
strcpy(dc->name, classname);
|
||||
dc->devices = NULL;
|
||||
@ -162,10 +161,9 @@ devclass_add_driver(devclass_t dc, driver_t *driver)
|
||||
|
||||
PDEBUG(("%s", DRIVERNAME(driver)));
|
||||
|
||||
dl = malloc(sizeof *dl, M_BUS, M_NOWAIT);
|
||||
dl = malloc(sizeof *dl, M_BUS, M_NOWAIT|M_ZERO);
|
||||
if (!dl)
|
||||
return ENOMEM;
|
||||
bzero(dl, sizeof *dl);
|
||||
|
||||
/*
|
||||
* Compile the driver's methods. Also increase the reference count
|
||||
@ -322,10 +320,9 @@ devclass_get_devices(devclass_t dc, device_t **devlistp, int *devcountp)
|
||||
if (dc->devices[i])
|
||||
count++;
|
||||
|
||||
list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT);
|
||||
list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
|
||||
if (!list)
|
||||
return ENOMEM;
|
||||
bzero(list, count * sizeof(device_t));
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < dc->maxunit; i++)
|
||||
@ -405,10 +402,9 @@ devclass_add_device(devclass_t dc, device_t dev)
|
||||
PDEBUG(("%s in devclass %s", DEVICENAME(dev), DEVCLANAME(dc)));
|
||||
|
||||
buflen = strlen(dc->name) + 5;
|
||||
dev->nameunit = malloc(buflen, M_BUS, M_NOWAIT);
|
||||
dev->nameunit = malloc(buflen, M_BUS, M_NOWAIT|M_ZERO);
|
||||
if (!dev->nameunit)
|
||||
return ENOMEM;
|
||||
bzero(dev->nameunit, buflen);
|
||||
|
||||
if ((error = devclass_alloc_unit(dc, &dev->unit)) != 0) {
|
||||
free(dev->nameunit, M_BUS);
|
||||
@ -460,10 +456,9 @@ make_device(device_t parent, const char *name, int unit)
|
||||
} else
|
||||
dc = NULL;
|
||||
|
||||
dev = malloc(sizeof(struct device), M_BUS, M_NOWAIT);
|
||||
dev = malloc(sizeof(struct device), M_BUS, M_NOWAIT|M_ZERO);
|
||||
if (!dev)
|
||||
return 0;
|
||||
bzero(dev, sizeof(struct device));
|
||||
|
||||
dev->parent = parent;
|
||||
TAILQ_INIT(&dev->children);
|
||||
@ -715,10 +710,9 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp)
|
||||
child = TAILQ_NEXT(child, link))
|
||||
count++;
|
||||
|
||||
list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT);
|
||||
list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
|
||||
if (!list)
|
||||
return ENOMEM;
|
||||
bzero(list, count * sizeof(device_t));
|
||||
|
||||
count = 0;
|
||||
for (child = TAILQ_FIRST(&dev->children); child;
|
||||
@ -993,13 +987,12 @@ device_set_driver(device_t dev, driver_t *driver)
|
||||
if (driver) {
|
||||
kobj_init((kobj_t) dev, (kobj_class_t) driver);
|
||||
if (!(dev->flags & DF_EXTERNALSOFTC)) {
|
||||
dev->softc = malloc(driver->size, M_BUS, M_NOWAIT);
|
||||
dev->softc = malloc(driver->size, M_BUS, M_NOWAIT|M_ZERO);
|
||||
if (!dev->softc) {
|
||||
kobj_init((kobj_t) dev, &null_class);
|
||||
dev->driver = NULL;
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero(dev->softc, driver->size);
|
||||
}
|
||||
} else
|
||||
kobj_init((kobj_t) dev, &null_class);
|
||||
|
@ -175,10 +175,9 @@ kobj_create(kobj_class_t cls,
|
||||
/*
|
||||
* Allocate and initialise the new object.
|
||||
*/
|
||||
obj = malloc(cls->size, mtype, mflags);
|
||||
obj = malloc(cls->size, mtype, mflags | M_ZERO);
|
||||
if (!obj)
|
||||
return 0;
|
||||
bzero(obj, cls->size);
|
||||
kobj_init(obj, cls);
|
||||
|
||||
return obj;
|
||||
|
@ -114,12 +114,11 @@ kmstartup(dummy)
|
||||
p->tolimit = MAXARCS;
|
||||
p->tossize = p->tolimit * sizeof(struct tostruct);
|
||||
cp = (char *)malloc(p->kcountsize + p->fromssize + p->tossize,
|
||||
M_GPROF, M_NOWAIT);
|
||||
M_GPROF, M_NOWAIT | M_ZERO);
|
||||
if (cp == 0) {
|
||||
printf("No memory for profiling.\n");
|
||||
return;
|
||||
}
|
||||
bzero(cp, p->kcountsize + p->tossize + p->fromssize);
|
||||
p->tos = (struct tostruct *)cp;
|
||||
cp += p->tossize;
|
||||
p->kcount = (HISTCOUNTER *)cp;
|
||||
|
@ -120,10 +120,9 @@ rman_manage_region(struct rman *rm, u_long start, u_long end)
|
||||
{
|
||||
struct resource *r, *s;
|
||||
|
||||
r = malloc(sizeof *r, M_RMAN, M_NOWAIT);
|
||||
r = malloc(sizeof *r, M_RMAN, M_NOWAIT | M_ZERO);
|
||||
if (r == 0)
|
||||
return ENOMEM;
|
||||
bzero(r, sizeof *r);
|
||||
r->r_sharehead = 0;
|
||||
r->r_start = start;
|
||||
r->r_end = end;
|
||||
@ -247,10 +246,9 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count,
|
||||
* split it in two. The first case requires
|
||||
* two new allocations; the second requires but one.
|
||||
*/
|
||||
rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT);
|
||||
rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT | M_ZERO);
|
||||
if (rv == 0)
|
||||
goto out;
|
||||
bzero(rv, sizeof *rv);
|
||||
rv->r_start = rstart;
|
||||
rv->r_end = rstart + count - 1;
|
||||
rv->r_flags = flags | RF_ALLOCATED;
|
||||
@ -267,13 +265,12 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count,
|
||||
/*
|
||||
* We are allocating in the middle.
|
||||
*/
|
||||
r = malloc(sizeof *r, M_RMAN, M_NOWAIT);
|
||||
r = malloc(sizeof *r, M_RMAN, M_NOWAIT|M_ZERO);
|
||||
if (r == 0) {
|
||||
free(rv, M_RMAN);
|
||||
rv = 0;
|
||||
goto out;
|
||||
}
|
||||
bzero(r, sizeof *r);
|
||||
r->r_start = rv->r_end + 1;
|
||||
r->r_end = s->r_end;
|
||||
r->r_flags = s->r_flags;
|
||||
@ -326,10 +323,9 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count,
|
||||
rend = min(s->r_end, max(start + count, end));
|
||||
if (s->r_start >= start && s->r_end <= end
|
||||
&& (s->r_end - s->r_start + 1) == count) {
|
||||
rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT);
|
||||
rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT | M_ZERO);
|
||||
if (rv == 0)
|
||||
goto out;
|
||||
bzero(rv, sizeof *rv);
|
||||
rv->r_start = s->r_start;
|
||||
rv->r_end = s->r_end;
|
||||
rv->r_flags = s->r_flags &
|
||||
@ -338,13 +334,12 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count,
|
||||
rv->r_rm = rm;
|
||||
if (s->r_sharehead == 0) {
|
||||
s->r_sharehead = malloc(sizeof *s->r_sharehead,
|
||||
M_RMAN, M_NOWAIT);
|
||||
M_RMAN, M_NOWAIT | M_ZERO);
|
||||
if (s->r_sharehead == 0) {
|
||||
free(rv, M_RMAN);
|
||||
rv = 0;
|
||||
goto out;
|
||||
}
|
||||
bzero(s->r_sharehead, sizeof *s->r_sharehead);
|
||||
LIST_INIT(s->r_sharehead);
|
||||
LIST_INSERT_HEAD(s->r_sharehead, s,
|
||||
r_sharelink);
|
||||
|
@ -599,9 +599,9 @@ mtx_init(struct mtx *m, const char *t, int flag)
|
||||
#endif
|
||||
|
||||
/* XXX - should not use DEVBUF */
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF, M_NOWAIT);
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
MPASS(debug != NULL);
|
||||
bzero(debug, sizeof(struct mtx_debug));
|
||||
}
|
||||
#endif
|
||||
bzero((void *)m, sizeof *m);
|
||||
|
@ -599,9 +599,9 @@ mtx_init(struct mtx *m, const char *t, int flag)
|
||||
#endif
|
||||
|
||||
/* XXX - should not use DEVBUF */
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF, M_NOWAIT);
|
||||
debug = malloc(sizeof(struct mtx_debug), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
MPASS(debug != NULL);
|
||||
bzero(debug, sizeof(struct mtx_debug));
|
||||
}
|
||||
#endif
|
||||
bzero((void *)m, sizeof *m);
|
||||
|
@ -2423,8 +2423,7 @@ ttymalloc(tp)
|
||||
|
||||
if (tp)
|
||||
return(tp);
|
||||
tp = malloc(sizeof *tp, M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof *tp);
|
||||
tp = malloc(sizeof *tp, M_TTYS, M_WAITOK | M_ZERO);
|
||||
ttyregister(tp);
|
||||
return (tp);
|
||||
}
|
||||
|
@ -147,8 +147,7 @@ ptyinit(n)
|
||||
if (n & ~0xff)
|
||||
return (NODEV);
|
||||
|
||||
pt = malloc(sizeof(*pt), M_PTY, M_WAITOK);
|
||||
bzero(pt, sizeof(*pt));
|
||||
pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
|
||||
pt->devs = devs = make_dev(&pts_cdevsw, n,
|
||||
UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
|
||||
pt->devc = devc = make_dev(&ptc_cdevsw, n,
|
||||
|
@ -291,8 +291,7 @@ snpopen(dev, flag, mode, p)
|
||||
if (dev->si_drv1 == NULL) {
|
||||
int mynor = minor(dev);
|
||||
|
||||
dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK);
|
||||
bzero(snp, sizeof(*snp));
|
||||
dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK|M_ZERO);
|
||||
make_dev(&snp_cdevsw, mynor, 0, 0, 0600, "snp%d", mynor);
|
||||
} else
|
||||
return (EBUSY);
|
||||
|
@ -1045,8 +1045,7 @@ do_setopt_accept_filter(so, sopt)
|
||||
error = ENOENT;
|
||||
goto out;
|
||||
}
|
||||
MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK);
|
||||
bzero(af, sizeof(*af));
|
||||
MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK | M_ZERO);
|
||||
if (afp->accf_create != NULL) {
|
||||
if (afap->af_name[0] != '\0') {
|
||||
int len = strlen(afap->af_name) + 1;
|
||||
@ -1310,8 +1309,7 @@ sogetopt(so, sopt)
|
||||
if ((so->so_options & SO_ACCEPTCONN) == 0)
|
||||
return (EINVAL);
|
||||
MALLOC(afap, struct accept_filter_arg *, sizeof(*afap),
|
||||
M_TEMP, M_WAITOK);
|
||||
bzero(afap, sizeof(*afap));
|
||||
M_TEMP, M_WAITOK | M_ZERO);
|
||||
if ((so->so_options & SO_ACCEPTFILTER) != 0) {
|
||||
strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name);
|
||||
if (so->so_accf->so_accept_filter_str != NULL)
|
||||
|
@ -1421,8 +1421,8 @@ sf_buf_init(void *arg)
|
||||
mtx_enter(&sf_freelist.sf_lock, MTX_DEF);
|
||||
SLIST_INIT(&sf_freelist);
|
||||
sf_base = kmem_alloc_pageable(kernel_map, nsfbufs * PAGE_SIZE);
|
||||
sf_bufs = malloc(nsfbufs * sizeof(struct sf_buf), M_TEMP, M_NOWAIT);
|
||||
bzero(sf_bufs, nsfbufs * sizeof(struct sf_buf));
|
||||
sf_bufs = malloc(nsfbufs * sizeof(struct sf_buf), M_TEMP,
|
||||
M_NOWAIT | M_ZERO);
|
||||
for (i = 0; i < nsfbufs; i++) {
|
||||
sf_bufs[i].kva = sf_base + i * PAGE_SIZE;
|
||||
SLIST_INSERT_HEAD(&sf_freelist, &sf_bufs[i], free_list);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user