mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-29 12:03:03 +00:00
Fix a number of style issues in the MALLOC / FREE commit. I've tried to
be careful not to fix anything that was already broken; the NFSv4 code is particularly bad in this respect.
This commit is contained in:
parent
cdab8377da
commit
e11e3f187d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184214
@ -202,8 +202,7 @@ hfsc_add_altq(struct pf_altq *a)
|
|||||||
if (!ALTQ_IS_READY(&ifp->if_snd))
|
if (!ALTQ_IS_READY(&ifp->if_snd))
|
||||||
return (ENODEV);
|
return (ENODEV);
|
||||||
|
|
||||||
hif = malloc(sizeof(struct hfsc_if),
|
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK);
|
||||||
M_DEVBUF, M_WAITOK);
|
|
||||||
if (hif == NULL)
|
if (hif == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
bzero(hif, sizeof(struct hfsc_if));
|
bzero(hif, sizeof(struct hfsc_if));
|
||||||
@ -404,14 +403,12 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cl = malloc(sizeof(struct hfsc_class),
|
cl = malloc(sizeof(struct hfsc_class), M_DEVBUF, M_WAITOK);
|
||||||
M_DEVBUF, M_WAITOK);
|
|
||||||
if (cl == NULL)
|
if (cl == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
bzero(cl, sizeof(struct hfsc_class));
|
bzero(cl, sizeof(struct hfsc_class));
|
||||||
|
|
||||||
cl->cl_q = malloc(sizeof(class_queue_t),
|
cl->cl_q = malloc(sizeof(class_queue_t), M_DEVBUF, M_WAITOK);
|
||||||
M_DEVBUF, M_WAITOK);
|
|
||||||
if (cl->cl_q == NULL)
|
if (cl->cl_q == NULL)
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
bzero(cl->cl_q, sizeof(class_queue_t));
|
bzero(cl->cl_q, sizeof(class_queue_t));
|
||||||
@ -471,7 +468,8 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
|
|||||||
#endif /* ALTQ_RED */
|
#endif /* ALTQ_RED */
|
||||||
|
|
||||||
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) {
|
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) {
|
||||||
cl->cl_rsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
cl->cl_rsc = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (cl->cl_rsc == NULL)
|
if (cl->cl_rsc == NULL)
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
sc2isc(rsc, cl->cl_rsc);
|
sc2isc(rsc, cl->cl_rsc);
|
||||||
@ -479,14 +477,16 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
|
|||||||
rtsc_init(&cl->cl_eligible, cl->cl_rsc, 0, 0);
|
rtsc_init(&cl->cl_eligible, cl->cl_rsc, 0, 0);
|
||||||
}
|
}
|
||||||
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) {
|
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) {
|
||||||
cl->cl_fsc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
cl->cl_fsc = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (cl->cl_fsc == NULL)
|
if (cl->cl_fsc == NULL)
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
sc2isc(fsc, cl->cl_fsc);
|
sc2isc(fsc, cl->cl_fsc);
|
||||||
rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0);
|
rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0);
|
||||||
}
|
}
|
||||||
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) {
|
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) {
|
||||||
cl->cl_usc = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
cl->cl_usc = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (cl->cl_usc == NULL)
|
if (cl->cl_usc == NULL)
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
sc2isc(usc, cl->cl_usc);
|
sc2isc(usc, cl->cl_usc);
|
||||||
@ -1740,8 +1740,7 @@ hfsc_attach(ifq, bandwidth)
|
|||||||
{
|
{
|
||||||
struct hfsc_if *hif;
|
struct hfsc_if *hif;
|
||||||
|
|
||||||
hif = malloc(sizeof(struct hfsc_if),
|
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK);
|
||||||
M_DEVBUF, M_WAITOK);
|
|
||||||
if (hif == NULL)
|
if (hif == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
bzero(hif, sizeof(struct hfsc_if));
|
bzero(hif, sizeof(struct hfsc_if));
|
||||||
@ -1801,19 +1800,22 @@ hfsc_class_modify(cl, rsc, fsc, usc)
|
|||||||
rsc_tmp = fsc_tmp = usc_tmp = NULL;
|
rsc_tmp = fsc_tmp = usc_tmp = NULL;
|
||||||
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) &&
|
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) &&
|
||||||
cl->cl_rsc == NULL) {
|
cl->cl_rsc == NULL) {
|
||||||
rsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
rsc_tmp = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (rsc_tmp == NULL)
|
if (rsc_tmp == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) &&
|
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) &&
|
||||||
cl->cl_fsc == NULL) {
|
cl->cl_fsc == NULL) {
|
||||||
fsc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
fsc_tmp = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (fsc_tmp == NULL)
|
if (fsc_tmp == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
|
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
|
||||||
cl->cl_usc == NULL) {
|
cl->cl_usc == NULL) {
|
||||||
usc_tmp = malloc( sizeof(struct internal_sc), M_DEVBUF, M_WAITOK);
|
usc_tmp = malloc(sizeof(struct internal_sc),
|
||||||
|
M_DEVBUF, M_WAITOK);
|
||||||
if (usc_tmp == NULL)
|
if (usc_tmp == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
|
@ -331,8 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
|
|||||||
int error, found, *newbits, tmp;
|
int error, found, *newbits, tmp;
|
||||||
size_t kwlen;
|
size_t kwlen;
|
||||||
|
|
||||||
tmpflags = malloc(sizeof(*tmpflags),
|
tmpflags = malloc(sizeof(*tmpflags), M_PMC, M_WAITOK|M_ZERO);
|
||||||
M_PMC, M_WAITOK|M_ZERO);
|
|
||||||
|
|
||||||
p = newstr;
|
p = newstr;
|
||||||
error = 0;
|
error = 0;
|
||||||
@ -777,8 +776,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
|
|||||||
__LINE__, pp, pm));
|
__LINE__, pp, pm));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pt = malloc(sizeof(struct pmc_target),
|
pt = malloc(sizeof(struct pmc_target), M_PMC, M_ZERO|M_WAITOK);
|
||||||
M_PMC, M_ZERO|M_WAITOK);
|
|
||||||
|
|
||||||
pt->pt_process = pp;
|
pt->pt_process = pp;
|
||||||
|
|
||||||
@ -1861,8 +1859,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
|
|||||||
poh = &pmc_ownerhash[hindex];
|
poh = &pmc_ownerhash[hindex];
|
||||||
|
|
||||||
/* allocate space for N pointers and one descriptor struct */
|
/* allocate space for N pointers and one descriptor struct */
|
||||||
po = malloc(sizeof(struct pmc_owner),
|
po = malloc(sizeof(struct pmc_owner), M_PMC, M_ZERO|M_WAITOK);
|
||||||
M_PMC, M_ZERO|M_WAITOK);
|
|
||||||
|
|
||||||
po->po_sscount = po->po_error = po->po_flags = 0;
|
po->po_sscount = po->po_error = po->po_flags = 0;
|
||||||
po->po_file = NULL;
|
po->po_file = NULL;
|
||||||
@ -2818,8 +2815,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
|||||||
npmc = md->pmd_npmc;
|
npmc = md->pmd_npmc;
|
||||||
|
|
||||||
pmcinfo_size = npmc * sizeof(struct pmc_info);
|
pmcinfo_size = npmc * sizeof(struct pmc_info);
|
||||||
pmcinfo = malloc(pmcinfo_size, M_PMC,
|
pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK);
|
||||||
M_WAITOK);
|
|
||||||
|
|
||||||
p = pmcinfo;
|
p = pmcinfo;
|
||||||
|
|
||||||
@ -4356,7 +4352,8 @@ pmc_initialize(void)
|
|||||||
M_PMC, M_WAITOK|M_ZERO);
|
M_PMC, M_WAITOK|M_ZERO);
|
||||||
|
|
||||||
/* per-cpu 'saved values' for managing process-mode PMCs */
|
/* per-cpu 'saved values' for managing process-mode PMCs */
|
||||||
pmc_pcpu_saved = malloc( sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK);
|
pmc_pcpu_saved = malloc(sizeof(pmc_value_t) * maxcpu * md->pmd_npmc,
|
||||||
|
M_PMC, M_WAITOK);
|
||||||
|
|
||||||
/* Perform CPU-dependent initialization. */
|
/* Perform CPU-dependent initialization. */
|
||||||
pmc_save_cpu_binding(&pb);
|
pmc_save_cpu_binding(&pb);
|
||||||
@ -4385,7 +4382,8 @@ pmc_initialize(void)
|
|||||||
KASSERT(pmc_pcpu[cpu] != NULL,
|
KASSERT(pmc_pcpu[cpu] != NULL,
|
||||||
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
|
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
|
||||||
|
|
||||||
sb->ps_callchains = malloc( pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t),
|
sb->ps_callchains = malloc(pmc_callchaindepth *
|
||||||
|
pmc_nsamples * sizeof(uintptr_t),
|
||||||
M_PMC, M_WAITOK|M_ZERO);
|
M_PMC, M_WAITOK|M_ZERO);
|
||||||
|
|
||||||
for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++)
|
for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++)
|
||||||
|
@ -628,7 +628,8 @@ p4_init(int cpu)
|
|||||||
if (pcs == NULL) /* decline to init */
|
if (pcs == NULL) /* decline to init */
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
plcs = malloc( sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO);
|
plcs = malloc(sizeof(struct p4_logicalcpu),
|
||||||
|
M_PMC, M_WAITOK|M_ZERO);
|
||||||
|
|
||||||
/* The TSC is architectural state and is not shared */
|
/* The TSC is architectural state and is not shared */
|
||||||
plcs->pc_hwpmcs[0] = &plcs->pc_tsc;
|
plcs->pc_hwpmcs[0] = &plcs->pc_tsc;
|
||||||
@ -644,8 +645,7 @@ p4_init(int cpu)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcs = malloc(sizeof(struct p4_cpu), M_PMC,
|
pcs = malloc(sizeof(struct p4_cpu), M_PMC, M_WAITOK|M_ZERO);
|
||||||
M_WAITOK|M_ZERO);
|
|
||||||
|
|
||||||
if (pcs == NULL)
|
if (pcs == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
@ -278,7 +278,8 @@ hpfs_cpinit (
|
|||||||
|
|
||||||
cpicnt = hpmp->hpm_sp.sp_cpinum;
|
cpicnt = hpmp->hpm_sp.sp_cpinum;
|
||||||
|
|
||||||
hpmp->hpm_cpdblk = malloc( cpicnt * sizeof(struct cpdblk), M_HPFSMNT, M_WAITOK);
|
hpmp->hpm_cpdblk = malloc(cpicnt * sizeof(struct cpdblk),
|
||||||
|
M_HPFSMNT, M_WAITOK);
|
||||||
|
|
||||||
cpdbp = hpmp->hpm_cpdblk;
|
cpdbp = hpmp->hpm_cpdblk;
|
||||||
lsn = hpmp->hpm_sp.sp_cpi;
|
lsn = hpmp->hpm_sp.sp_cpi;
|
||||||
|
@ -1143,7 +1143,8 @@ ntfs_ntreaddir(
|
|||||||
|
|
||||||
if (fp->f_dirblbuf == NULL) {
|
if (fp->f_dirblbuf == NULL) {
|
||||||
fp->f_dirblsz = vap->va_a_iroot->ir_size;
|
fp->f_dirblsz = vap->va_a_iroot->ir_size;
|
||||||
fp->f_dirblbuf = malloc( max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK);
|
fp->f_dirblbuf = malloc(max(vap->va_datalen,fp->f_dirblsz),
|
||||||
|
M_NTFSDIR, M_WAITOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
blsize = fp->f_dirblsz;
|
blsize = fp->f_dirblsz;
|
||||||
|
@ -647,8 +647,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
|
|||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
size = UDF_FENTRY_SIZE + le32toh(fe->l_ea) + le32toh(fe->l_ad);
|
size = UDF_FENTRY_SIZE + le32toh(fe->l_ea) + le32toh(fe->l_ad);
|
||||||
unode->fentry = malloc(size, M_UDFFENTRY,
|
unode->fentry = malloc(size, M_UDFFENTRY, M_NOWAIT | M_ZERO);
|
||||||
M_NOWAIT | M_ZERO);
|
|
||||||
if (unode->fentry == NULL) {
|
if (unode->fentry == NULL) {
|
||||||
printf("Cannot allocate file entry block\n");
|
printf("Cannot allocate file entry block\n");
|
||||||
vgone(vp);
|
vgone(vp);
|
||||||
@ -757,7 +756,8 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
|
|||||||
|
|
||||||
pms = (struct part_map_spare *)pmap;
|
pms = (struct part_map_spare *)pmap;
|
||||||
pmap += UDF_PMAP_TYPE2_SIZE;
|
pmap += UDF_PMAP_TYPE2_SIZE;
|
||||||
udfmp->s_table = malloc( le32toh(pms->st_size), M_UDFMOUNT, M_NOWAIT | M_ZERO);
|
udfmp->s_table = malloc(le32toh(pms->st_size),
|
||||||
|
M_UDFMOUNT, M_NOWAIT | M_ZERO);
|
||||||
if (udfmp->s_table == NULL)
|
if (udfmp->s_table == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
|
@ -440,7 +440,8 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create a new unionfs node status */
|
/* create a new unionfs node status */
|
||||||
unsp = malloc( sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO);
|
unsp = malloc(sizeof(struct unionfs_node_status),
|
||||||
|
M_TEMP, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
unsp->uns_pid = pid;
|
unsp->uns_pid = pid;
|
||||||
LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list);
|
LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list);
|
||||||
|
@ -529,8 +529,7 @@ filt_timerattach(struct knote *kn)
|
|||||||
|
|
||||||
kn->kn_flags |= EV_CLEAR; /* automatically set */
|
kn->kn_flags |= EV_CLEAR; /* automatically set */
|
||||||
kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */
|
kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */
|
||||||
calloutp = malloc(sizeof(*calloutp),
|
calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK);
|
||||||
M_KQUEUE, M_WAITOK);
|
|
||||||
callout_init(calloutp, CALLOUT_MPSAFE);
|
callout_init(calloutp, CALLOUT_MPSAFE);
|
||||||
kn->kn_hook = calloutp;
|
kn->kn_hook = calloutp;
|
||||||
callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata),
|
callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata),
|
||||||
|
@ -1893,8 +1893,8 @@ linker_hwpmc_list_objects(void)
|
|||||||
|
|
||||||
retry:
|
retry:
|
||||||
/* allocate nmappings+1 entries */
|
/* allocate nmappings+1 entries */
|
||||||
hc.kobase = malloc( (hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER,
|
hc.kobase = malloc((hc.nmappings + 1) * sizeof(struct pmckern_map_in),
|
||||||
M_WAITOK | M_ZERO);
|
M_LINKER, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
hc.nobjects = 0;
|
hc.nobjects = 0;
|
||||||
if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) {
|
if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) {
|
||||||
|
@ -146,7 +146,8 @@ mtx_pool_create(const char *mtx_name, int pool_size, int opts)
|
|||||||
mtx_name);
|
mtx_name);
|
||||||
pool_size = 128;
|
pool_size = 128;
|
||||||
}
|
}
|
||||||
pool = malloc( sizeof (struct mtx_pool) + ((pool_size - 1) * sizeof (struct mtx)),
|
pool = malloc(sizeof (struct mtx_pool) +
|
||||||
|
((pool_size - 1) * sizeof (struct mtx)),
|
||||||
M_MTXPOOL, M_WAITOK | M_ZERO);
|
M_MTXPOOL, M_WAITOK | M_ZERO);
|
||||||
mtx_pool_initialize(pool, mtx_name, pool_size, opts);
|
mtx_pool_initialize(pool, mtx_name, pool_size, opts);
|
||||||
return pool;
|
return pool;
|
||||||
|
@ -664,7 +664,8 @@ sltstart(struct tty *tp)
|
|||||||
register u_char *cp;
|
register u_char *cp;
|
||||||
|
|
||||||
if (sc->bpfbuf == NULL)
|
if (sc->bpfbuf == NULL)
|
||||||
sc->bpfbuf = malloc( SLTMAX + SLIP_HDRLEN, M_SL, M_NOWAIT);
|
sc->bpfbuf = malloc(SLTMAX + SLIP_HDRLEN,
|
||||||
|
M_SL, M_NOWAIT);
|
||||||
|
|
||||||
if (sc->bpfbuf) {
|
if (sc->bpfbuf) {
|
||||||
cp = sc->bpfbuf + SLIP_HDRLEN;
|
cp = sc->bpfbuf + SLIP_HDRLEN;
|
||||||
|
@ -190,10 +190,12 @@ nga_constructor(node_p node)
|
|||||||
sc->cfg.accm = ~0;
|
sc->cfg.accm = ~0;
|
||||||
sc->cfg.amru = NG_ASYNC_DEFAULT_MRU;
|
sc->cfg.amru = NG_ASYNC_DEFAULT_MRU;
|
||||||
sc->cfg.smru = NG_ASYNC_DEFAULT_MRU;
|
sc->cfg.smru = NG_ASYNC_DEFAULT_MRU;
|
||||||
sc->abuf = malloc( ASYNC_BUF_SIZE(sc->cfg.smru), M_NETGRAPH_ASYNC, M_NOWAIT);
|
sc->abuf = malloc(ASYNC_BUF_SIZE(sc->cfg.smru),
|
||||||
|
M_NETGRAPH_ASYNC, M_NOWAIT);
|
||||||
if (sc->abuf == NULL)
|
if (sc->abuf == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
sc->sbuf = malloc( SYNC_BUF_SIZE(sc->cfg.amru), M_NETGRAPH_ASYNC, M_NOWAIT);
|
sc->sbuf = malloc(SYNC_BUF_SIZE(sc->cfg.amru),
|
||||||
|
M_NETGRAPH_ASYNC, M_NOWAIT);
|
||||||
if (sc->sbuf == NULL) {
|
if (sc->sbuf == NULL) {
|
||||||
free(sc->abuf, M_NETGRAPH_ASYNC);
|
free(sc->abuf, M_NETGRAPH_ASYNC);
|
||||||
fail:
|
fail:
|
||||||
|
@ -304,7 +304,8 @@ ng_bridge_constructor(node_p node)
|
|||||||
ng_callout_init(&priv->timer);
|
ng_callout_init(&priv->timer);
|
||||||
|
|
||||||
/* Allocate and initialize hash table, etc. */
|
/* Allocate and initialize hash table, etc. */
|
||||||
priv->tab = malloc( MIN_BUCKETS * sizeof(*priv->tab), M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO);
|
priv->tab = malloc(MIN_BUCKETS * sizeof(*priv->tab),
|
||||||
|
M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO);
|
||||||
if (priv->tab == NULL) {
|
if (priv->tab == NULL) {
|
||||||
free(priv, M_NETGRAPH_BRIDGE);
|
free(priv, M_NETGRAPH_BRIDGE);
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
@ -358,7 +359,8 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name)
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
if (priv->links[linkNum] != NULL)
|
if (priv->links[linkNum] != NULL)
|
||||||
return (EISCONN);
|
return (EISCONN);
|
||||||
priv->links[linkNum] = malloc( sizeof(*priv->links[linkNum]), M_NETGRAPH_BRIDGE, M_NOWAIT|M_ZERO);
|
priv->links[linkNum] = malloc(sizeof(*priv->links[linkNum]),
|
||||||
|
M_NETGRAPH_BRIDGE, M_NOWAIT|M_ZERO);
|
||||||
if (priv->links[linkNum] == NULL)
|
if (priv->links[linkNum] == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
priv->links[linkNum]->hook = hook;
|
priv->links[linkNum]->hook = hook;
|
||||||
@ -892,7 +894,8 @@ ng_bridge_rehash(priv_p priv)
|
|||||||
newMask = newNumBuckets - 1;
|
newMask = newNumBuckets - 1;
|
||||||
|
|
||||||
/* Allocate and initialize new table */
|
/* Allocate and initialize new table */
|
||||||
newTab = malloc( newNumBuckets * sizeof(*newTab), M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO);
|
newTab = malloc(newNumBuckets * sizeof(*newTab),
|
||||||
|
M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO);
|
||||||
if (newTab == NULL)
|
if (newTab == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -428,7 +428,8 @@ ng_l2tp_newhook(node_p node, hook_p hook, const char *name)
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
/* Create hook private structure */
|
/* Create hook private structure */
|
||||||
hpriv = malloc( sizeof(*hpriv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO);
|
hpriv = malloc(sizeof(*hpriv),
|
||||||
|
M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO);
|
||||||
if (hpriv == NULL)
|
if (hpriv == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
hpriv->conf.session_id = session_id;
|
hpriv->conf.session_id = session_id;
|
||||||
|
@ -295,7 +295,8 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
|||||||
d->history = NULL;
|
d->history = NULL;
|
||||||
}
|
}
|
||||||
if ((cfg->bits & MPPC_BIT) != 0) {
|
if ((cfg->bits & MPPC_BIT) != 0) {
|
||||||
d->history = malloc( isComp ? MPPC_SizeOfCompressionHistory() :
|
d->history = malloc(isComp ?
|
||||||
|
MPPC_SizeOfCompressionHistory() :
|
||||||
MPPC_SizeOfDecompressionHistory(),
|
MPPC_SizeOfDecompressionHistory(),
|
||||||
M_NETGRAPH_MPPC, M_NOWAIT);
|
M_NETGRAPH_MPPC, M_NOWAIT);
|
||||||
if (d->history == NULL)
|
if (d->history == NULL)
|
||||||
|
@ -1634,8 +1634,8 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
|
|||||||
pkss = kss;
|
pkss = kss;
|
||||||
nims = NULL;
|
nims = NULL;
|
||||||
for (i = 0; i < msfr.msfr_nsrcs; i++, pkss++) {
|
for (i = 0; i < msfr.msfr_nsrcs; i++, pkss++) {
|
||||||
nims = malloc( sizeof(struct in_msource) * msfr.msfr_nsrcs,
|
nims = malloc(sizeof(struct in_msource) *
|
||||||
M_IPMSOURCE, M_WAITOK | M_ZERO);
|
msfr.msfr_nsrcs, M_IPMSOURCE, M_WAITOK | M_ZERO);
|
||||||
pnims[i] = nims;
|
pnims[i] = nims;
|
||||||
}
|
}
|
||||||
if (i < msfr.msfr_nsrcs) {
|
if (i < msfr.msfr_nsrcs) {
|
||||||
|
@ -247,8 +247,8 @@ syncache_init(void)
|
|||||||
&V_tcp_syncache.cache_limit);
|
&V_tcp_syncache.cache_limit);
|
||||||
|
|
||||||
/* Allocate the hash table. */
|
/* Allocate the hash table. */
|
||||||
V_tcp_syncache.hashbase = malloc( V_tcp_syncache.hashsize * sizeof(struct syncache_head),
|
V_tcp_syncache.hashbase = malloc(V_tcp_syncache.hashsize *
|
||||||
M_SYNCACHE, M_WAITOK | M_ZERO);
|
sizeof(struct syncache_head), M_SYNCACHE, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
/* Initialize the hash buckets. */
|
/* Initialize the hash buckets. */
|
||||||
for (i = 0; i < V_tcp_syncache.hashsize; i++) {
|
for (i = 0; i < V_tcp_syncache.hashsize; i++) {
|
||||||
|
@ -2235,8 +2235,7 @@ nfs4_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
|
|||||||
if (vp->v_type == VDIR)
|
if (vp->v_type == VDIR)
|
||||||
panic("nfs: sillyrename dir");
|
panic("nfs: sillyrename dir");
|
||||||
#endif
|
#endif
|
||||||
sp = malloc(sizeof (struct sillyrename),
|
sp = malloc(sizeof (struct sillyrename), M_NFSREQ, M_WAITOK);
|
||||||
M_NFSREQ, M_WAITOK);
|
|
||||||
sp->s_cred = crhold(cnp->cn_cred);
|
sp->s_cred = crhold(cnp->cn_cred);
|
||||||
sp->s_dvp = dvp;
|
sp->s_dvp = dvp;
|
||||||
sp->s_removeit = nfs4_removeit;
|
sp->s_removeit = nfs4_removeit;
|
||||||
|
@ -281,7 +281,8 @@ nfs_dolock(struct vop_advlock_args *ap)
|
|||||||
* if there is no nfsowner table yet, allocate one.
|
* if there is no nfsowner table yet, allocate one.
|
||||||
*/
|
*/
|
||||||
if (p->p_nlminfo == NULL) {
|
if (p->p_nlminfo == NULL) {
|
||||||
p->p_nlminfo = malloc( sizeof(struct nlminfo), M_NLMINFO, M_WAITOK | M_ZERO);
|
p->p_nlminfo = malloc(sizeof(struct nlminfo),
|
||||||
|
M_NLMINFO, M_WAITOK | M_ZERO);
|
||||||
p->p_nlminfo->pid_start = p->p_stats->p_start;
|
p->p_nlminfo->pid_start = p->p_stats->p_start;
|
||||||
timevaladd(&p->p_nlminfo->pid_start, &boottime);
|
timevaladd(&p->p_nlminfo->pid_start, &boottime);
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,8 @@ cryptof_ioctl(
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
crie.cri_key = malloc( crie.cri_klen / 8, M_XDATA, M_WAITOK);
|
crie.cri_key = malloc(crie.cri_klen / 8,
|
||||||
|
M_XDATA, M_WAITOK);
|
||||||
if ((error = copyin(sop->key, crie.cri_key,
|
if ((error = copyin(sop->key, crie.cri_key,
|
||||||
crie.cri_klen / 8)))
|
crie.cri_klen / 8)))
|
||||||
goto bail;
|
goto bail;
|
||||||
@ -284,7 +285,8 @@ cryptof_ioctl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cria.cri_klen) {
|
if (cria.cri_klen) {
|
||||||
cria.cri_key = malloc( cria.cri_klen / 8, M_XDATA, M_WAITOK);
|
cria.cri_key = malloc(cria.cri_klen / 8,
|
||||||
|
M_XDATA, M_WAITOK);
|
||||||
if ((error = copyin(sop->mackey, cria.cri_key,
|
if ((error = copyin(sop->mackey, cria.cri_key,
|
||||||
cria.cri_klen / 8)))
|
cria.cri_klen / 8)))
|
||||||
goto bail;
|
goto bail;
|
||||||
@ -776,11 +778,9 @@ csecreate(struct fcrypt *fcr, u_int64_t sid, caddr_t key, u_int64_t keylen,
|
|||||||
|
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
/* NB: required when mtx_init is built with INVARIANTS */
|
/* NB: required when mtx_init is built with INVARIANTS */
|
||||||
cse = malloc(sizeof(struct csession),
|
cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT | M_ZERO);
|
||||||
M_XDATA, M_NOWAIT | M_ZERO);
|
|
||||||
#else
|
#else
|
||||||
cse = malloc(sizeof(struct csession),
|
cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT);
|
||||||
M_XDATA, M_NOWAIT);
|
|
||||||
#endif
|
#endif
|
||||||
if (cse == NULL)
|
if (cse == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -152,7 +152,8 @@ sysctl_rule(SYSCTL_HANDLER_ARGS)
|
|||||||
error = SYSCTL_IN(req, &temprule, sizeof(temprule));
|
error = SYSCTL_IN(req, &temprule, sizeof(temprule));
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
ruleptr = malloc( sizeof(*ruleptr), M_MACBSDEXTENDED, M_WAITOK | M_ZERO);
|
ruleptr = malloc(sizeof(*ruleptr), M_MACBSDEXTENDED,
|
||||||
|
M_WAITOK | M_ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtx_lock(&ugidfw_mtx);
|
mtx_lock(&ugidfw_mtx);
|
||||||
|
@ -3920,7 +3920,8 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
|
|||||||
if (inodedep->id_savedino1 != NULL)
|
if (inodedep->id_savedino1 != NULL)
|
||||||
panic("initiate_write_inodeblock_ufs1: I/O underway");
|
panic("initiate_write_inodeblock_ufs1: I/O underway");
|
||||||
FREE_LOCK(&lk);
|
FREE_LOCK(&lk);
|
||||||
sip = malloc( sizeof(struct ufs1_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS);
|
sip = malloc(sizeof(struct ufs1_dinode),
|
||||||
|
M_SAVEDINO, M_SOFTDEP_FLAGS);
|
||||||
ACQUIRE_LOCK(&lk);
|
ACQUIRE_LOCK(&lk);
|
||||||
inodedep->id_savedino1 = sip;
|
inodedep->id_savedino1 = sip;
|
||||||
*inodedep->id_savedino1 = *dp;
|
*inodedep->id_savedino1 = *dp;
|
||||||
@ -4065,7 +4066,8 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
|
|||||||
if (inodedep->id_savedino2 != NULL)
|
if (inodedep->id_savedino2 != NULL)
|
||||||
panic("initiate_write_inodeblock_ufs2: I/O underway");
|
panic("initiate_write_inodeblock_ufs2: I/O underway");
|
||||||
FREE_LOCK(&lk);
|
FREE_LOCK(&lk);
|
||||||
sip = malloc( sizeof(struct ufs2_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS);
|
sip = malloc(sizeof(struct ufs2_dinode),
|
||||||
|
M_SAVEDINO, M_SOFTDEP_FLAGS);
|
||||||
ACQUIRE_LOCK(&lk);
|
ACQUIRE_LOCK(&lk);
|
||||||
inodedep->id_savedino2 = sip;
|
inodedep->id_savedino2 = sip;
|
||||||
*inodedep->id_savedino2 = *dp;
|
*inodedep->id_savedino2 = *dp;
|
||||||
|
@ -588,7 +588,8 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
|
|||||||
if (backing_vnode->v_type != VREG)
|
if (backing_vnode->v_type != VREG)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
attribute = malloc( sizeof(struct ufs_extattr_list_entry), M_UFS_EXTATTR, M_WAITOK);
|
attribute = malloc(sizeof(struct ufs_extattr_list_entry),
|
||||||
|
M_UFS_EXTATTR, M_WAITOK);
|
||||||
if (attribute == NULL)
|
if (attribute == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user