1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-27 11:55:06 +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:
Dag-Erling Smørgrav 2008-10-23 20:26:15 +00:00
parent cdab8377da
commit e11e3f187d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184214
32 changed files with 96 additions and 81 deletions

View File

@ -202,8 +202,7 @@ hfsc_add_altq(struct pf_altq *a)
if (!ALTQ_IS_READY(&ifp->if_snd))
return (ENODEV);
hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK);
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK);
if (hif == NULL)
return (ENOMEM);
bzero(hif, sizeof(struct hfsc_if));
@ -404,14 +403,12 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
}
#endif
cl = malloc(sizeof(struct hfsc_class),
M_DEVBUF, M_WAITOK);
cl = malloc(sizeof(struct hfsc_class), M_DEVBUF, M_WAITOK);
if (cl == NULL)
return (NULL);
bzero(cl, sizeof(struct hfsc_class));
cl->cl_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
cl->cl_q = malloc(sizeof(class_queue_t), M_DEVBUF, M_WAITOK);
if (cl->cl_q == NULL)
goto err_ret;
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 */
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)
goto err_ret;
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);
}
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)
goto err_ret;
sc2isc(fsc, cl->cl_fsc);
rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 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)
goto err_ret;
sc2isc(usc, cl->cl_usc);
@ -1740,8 +1740,7 @@ hfsc_attach(ifq, bandwidth)
{
struct hfsc_if *hif;
hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK);
hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK);
if (hif == NULL)
return (NULL);
bzero(hif, sizeof(struct hfsc_if));
@ -1801,19 +1800,22 @@ hfsc_class_modify(cl, rsc, fsc, usc)
rsc_tmp = fsc_tmp = usc_tmp = NULL;
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0) &&
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)
return (ENOMEM);
}
if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0) &&
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)
return (ENOMEM);
}
if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
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)
return (ENOMEM);
}

View File

@ -331,8 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
int error, found, *newbits, tmp;
size_t kwlen;
tmpflags = malloc(sizeof(*tmpflags),
M_PMC, M_WAITOK|M_ZERO);
tmpflags = malloc(sizeof(*tmpflags), M_PMC, M_WAITOK|M_ZERO);
p = newstr;
error = 0;
@ -777,8 +776,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
__LINE__, pp, pm));
#endif
pt = malloc(sizeof(struct pmc_target),
M_PMC, M_ZERO|M_WAITOK);
pt = malloc(sizeof(struct pmc_target), M_PMC, M_ZERO|M_WAITOK);
pt->pt_process = pp;
@ -1861,8 +1859,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
poh = &pmc_ownerhash[hindex];
/* allocate space for N pointers and one descriptor struct */
po = malloc(sizeof(struct pmc_owner),
M_PMC, M_ZERO|M_WAITOK);
po = malloc(sizeof(struct pmc_owner), M_PMC, M_ZERO|M_WAITOK);
po->po_sscount = po->po_error = po->po_flags = 0;
po->po_file = NULL;
@ -1915,7 +1912,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
if (mode & PMC_FLAG_ALLOCATE) {
/* allocate additional space for 'n' pmc pointers */
ppnew = malloc( sizeof(struct pmc_process) + md->pmd_npmc *
ppnew = malloc(sizeof(struct pmc_process) + md->pmd_npmc *
sizeof(struct pmc_targetstate), M_PMC, M_ZERO|M_WAITOK);
}
@ -2818,8 +2815,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
npmc = md->pmd_npmc;
pmcinfo_size = npmc * sizeof(struct pmc_info);
pmcinfo = malloc(pmcinfo_size, M_PMC,
M_WAITOK);
pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK);
p = pmcinfo;
@ -4356,7 +4352,8 @@ pmc_initialize(void)
M_PMC, M_WAITOK|M_ZERO);
/* 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. */
pmc_save_cpu_binding(&pb);
@ -4376,7 +4373,7 @@ pmc_initialize(void)
for (cpu = 0; cpu < maxcpu; cpu++) {
if (!pmc_cpu_is_active(cpu))
continue;
sb = malloc( sizeof(struct pmc_samplebuffer) +
sb = malloc(sizeof(struct pmc_samplebuffer) +
pmc_nsamples * sizeof(struct pmc_sample), M_PMC,
M_WAITOK|M_ZERO);
@ -4385,7 +4382,8 @@ pmc_initialize(void)
KASSERT(pmc_pcpu[cpu] != NULL,
("[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);
for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++)

View File

@ -628,7 +628,8 @@ p4_init(int cpu)
if (pcs == NULL) /* decline to init */
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 */
plcs->pc_hwpmcs[0] = &plcs->pc_tsc;
@ -644,8 +645,7 @@ p4_init(int cpu)
return 0;
}
pcs = malloc(sizeof(struct p4_cpu), M_PMC,
M_WAITOK|M_ZERO);
pcs = malloc(sizeof(struct p4_cpu), M_PMC, M_WAITOK|M_ZERO);
if (pcs == NULL)
return ENOMEM;

View File

@ -3177,7 +3177,7 @@ ray_com_malloc(ray_comqfn_t function, int flags, char *mesg)
{
struct ray_comq_entry *com;
com = malloc( sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK);
com = malloc(sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK);
return (ray_com_init(com, function, flags, mesg));
}

View File

@ -305,7 +305,7 @@ sr_attach(device_t device)
int unit; /* index: channel w/in card */
hc = (struct sr_hardc *)device_get_softc(device);
sc = malloc( hc->numports * sizeof(struct sr_softc),
sc = malloc(hc->numports * sizeof(struct sr_softc),
M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL)
goto errexit;

View File

@ -278,7 +278,8 @@ hpfs_cpinit (
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;
lsn = hpmp->hpm_sp.sp_cpi;

View File

@ -1143,7 +1143,8 @@ ntfs_ntreaddir(
if (fp->f_dirblbuf == NULL) {
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;

View File

@ -416,7 +416,7 @@ ntfs_mountfs(devvp, mp, td)
}
/* Alloc memory for attribute definitions */
ntmp->ntm_ad = malloc( num * sizeof(struct ntvattrdef),
ntmp->ntm_ad = malloc(num * sizeof(struct ntvattrdef),
M_NTFSMNT, M_WAITOK);
ntmp->ntm_adnum = num;

View File

@ -647,8 +647,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
return (ENOMEM);
}
size = UDF_FENTRY_SIZE + le32toh(fe->l_ea) + le32toh(fe->l_ad);
unode->fentry = malloc(size, M_UDFFENTRY,
M_NOWAIT | M_ZERO);
unode->fentry = malloc(size, M_UDFFENTRY, M_NOWAIT | M_ZERO);
if (unode->fentry == NULL) {
printf("Cannot allocate file entry block\n");
vgone(vp);
@ -757,7 +756,8 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
pms = (struct part_map_spare *)pmap;
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)
return (ENOMEM);

View File

@ -440,7 +440,8 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
}
/* 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;
LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list);

View File

@ -2409,7 +2409,7 @@ filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp, s
{
struct filedesc_to_leader *fdtol;
fdtol = malloc( sizeof(struct filedesc_to_leader),
fdtol = malloc(sizeof(struct filedesc_to_leader),
M_FILEDESC_TO_LEADER,
M_WAITOK);
fdtol->fdl_refcount = 1;

View File

@ -529,8 +529,7 @@ filt_timerattach(struct knote *kn)
kn->kn_flags |= EV_CLEAR; /* automatically set */
kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */
calloutp = malloc(sizeof(*calloutp),
M_KQUEUE, M_WAITOK);
calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK);
callout_init(calloutp, CALLOUT_MPSAFE);
kn->kn_hook = calloutp;
callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata),
@ -1109,7 +1108,7 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
size = kq->kq_knlistsize;
while (size <= fd)
size += KQEXTENT;
list = malloc( size * sizeof list, M_KQUEUE, mflag);
list = malloc(size * sizeof list, M_KQUEUE, mflag);
if (list == NULL)
return ENOMEM;
KQ_LOCK(kq);

View File

@ -1893,8 +1893,8 @@ linker_hwpmc_list_objects(void)
retry:
/* allocate nmappings+1 entries */
hc.kobase = malloc( (hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER,
M_WAITOK | M_ZERO);
hc.kobase = malloc((hc.nmappings + 1) * sizeof(struct pmckern_map_in),
M_LINKER, M_WAITOK | M_ZERO);
hc.nobjects = 0;
if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) {

View File

@ -146,7 +146,8 @@ mtx_pool_create(const char *mtx_name, int pool_size, int opts)
mtx_name);
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);
mtx_pool_initialize(pool, mtx_name, pool_size, opts);
return pool;

View File

@ -708,7 +708,7 @@ witness_initialize(void *dummy __unused)
struct witness *w, *w1;
int i;
w_data = malloc( sizeof (struct witness) * WITNESS_COUNT, M_WITNESS,
w_data = malloc(sizeof (struct witness) * WITNESS_COUNT, M_WITNESS,
M_NOWAIT | M_ZERO);
/*

View File

@ -664,7 +664,8 @@ sltstart(struct tty *tp)
register u_char *cp;
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) {
cp = sc->bpfbuf + SLIP_HDRLEN;

View File

@ -377,7 +377,7 @@ ng_btsocket_l2cap_raw_input(void *context, int pending)
rt = (ng_btsocket_l2cap_rtentry_t *)
NG_HOOK_PRIVATE(hook);
if (rt == NULL) {
rt = malloc( sizeof(*rt),
rt = malloc(sizeof(*rt),
M_NETGRAPH_BTSOCKET_L2CAP_RAW,
M_NOWAIT|M_ZERO);
if (rt == NULL)

View File

@ -331,7 +331,7 @@ ng_netflow_cache_init(priv_p priv)
uma_zone_set_max(priv->zone, CACHESIZE);
/* Allocate hash. */
priv->hash = malloc( NBUCKETS * sizeof(struct flow_hash_entry),
priv->hash = malloc(NBUCKETS * sizeof(struct flow_hash_entry),
M_NETFLOW_HASH, M_WAITOK | M_ZERO);
if (priv->hash == NULL) {

View File

@ -190,10 +190,12 @@ nga_constructor(node_p node)
sc->cfg.accm = ~0;
sc->cfg.amru = 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)
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) {
free(sc->abuf, M_NETGRAPH_ASYNC);
fail:

View File

@ -304,7 +304,8 @@ ng_bridge_constructor(node_p node)
ng_callout_init(&priv->timer);
/* 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) {
free(priv, M_NETGRAPH_BRIDGE);
return (ENOMEM);
@ -358,7 +359,8 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name)
return (EINVAL);
if (priv->links[linkNum] != NULL)
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)
return (ENOMEM);
priv->links[linkNum]->hook = hook;
@ -848,7 +850,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, int linkNum)
#endif
/* Allocate and initialize new hashtable entry */
hent = malloc( sizeof(*hent), M_NETGRAPH_BRIDGE, M_NOWAIT);
hent = malloc(sizeof(*hent), M_NETGRAPH_BRIDGE, M_NOWAIT);
if (hent == NULL)
return (0);
bcopy(addr, hent->host.addr, ETHER_ADDR_LEN);
@ -892,7 +894,8 @@ ng_bridge_rehash(priv_p priv)
newMask = newNumBuckets - 1;
/* 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)
return;

View File

@ -403,7 +403,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
}
/* Allocate new list entry. */
new = malloc( sizeof(struct ng_fec_portlist), M_NETGRAPH, M_NOWAIT);
new = malloc(sizeof(struct ng_fec_portlist), M_NETGRAPH, M_NOWAIT);
if (new == NULL)
return(ENOMEM);

View File

@ -428,7 +428,8 @@ ng_l2tp_newhook(node_p node, hook_p hook, const char *name)
return (EINVAL);
/* 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)
return (ENOMEM);
hpriv->conf.session_id = session_id;

View File

@ -295,7 +295,8 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook)
d->history = NULL;
}
if ((cfg->bits & MPPC_BIT) != 0) {
d->history = malloc( isComp ? MPPC_SizeOfCompressionHistory() :
d->history = malloc(isComp ?
MPPC_SizeOfCompressionHistory() :
MPPC_SizeOfDecompressionHistory(),
M_NETGRAPH_MPPC, M_NOWAIT);
if (d->history == NULL)

View File

@ -817,7 +817,7 @@ inp_get_source_filters(struct inpcb *inp, struct sockopt *sopt)
* has asked for, but we always tell userland how big the
* buffer really needs to be.
*/
tss = malloc( sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
tss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
M_TEMP, M_NOWAIT);
if (tss == NULL) {
error = ENOBUFS;
@ -1569,7 +1569,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
* that we may copy them with a single copyin. This
* allows us to deal with page faults up-front.
*/
kss = malloc( sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
kss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
M_TEMP, M_WAITOK);
error = copyin(msfr.msfr_srcs, kss,
sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs);
@ -1623,7 +1623,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
* entries we are about to allocate, in case we
* abruptly need to free them.
*/
pnims = malloc( sizeof(struct in_msource *) * msfr.msfr_nsrcs,
pnims = malloc(sizeof(struct in_msource *) * msfr.msfr_nsrcs,
M_TEMP, M_WAITOK | M_ZERO);
/*
@ -1634,8 +1634,8 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
pkss = kss;
nims = NULL;
for (i = 0; i < msfr.msfr_nsrcs; i++, pkss++) {
nims = malloc( sizeof(struct in_msource) * msfr.msfr_nsrcs,
M_IPMSOURCE, M_WAITOK | M_ZERO);
nims = malloc(sizeof(struct in_msource) *
msfr.msfr_nsrcs, M_IPMSOURCE, M_WAITOK | M_ZERO);
pnims[i] = nims;
}
if (i < msfr.msfr_nsrcs) {

View File

@ -247,8 +247,8 @@ syncache_init(void)
&V_tcp_syncache.cache_limit);
/* Allocate the hash table. */
V_tcp_syncache.hashbase = malloc( V_tcp_syncache.hashsize * sizeof(struct syncache_head),
M_SYNCACHE, M_WAITOK | M_ZERO);
V_tcp_syncache.hashbase = malloc(V_tcp_syncache.hashsize *
sizeof(struct syncache_head), M_SYNCACHE, M_WAITOK | M_ZERO);
/* Initialize the hash buckets. */
for (i = 0; i < V_tcp_syncache.hashsize; i++) {

View File

@ -565,7 +565,7 @@ rip6_attach(struct socket *so, int proto, struct thread *td)
error = soreserve(so, rip_sendspace, rip_recvspace);
if (error)
return (error);
filter = malloc( sizeof(struct icmp6_filter), M_PCB, M_NOWAIT);
filter = malloc(sizeof(struct icmp6_filter), M_PCB, M_NOWAIT);
if (filter == NULL)
return (ENOMEM);
INP_INFO_WLOCK(&V_ripcbinfo);

View File

@ -2235,8 +2235,7 @@ nfs4_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
if (vp->v_type == VDIR)
panic("nfs: sillyrename dir");
#endif
sp = malloc(sizeof (struct sillyrename),
M_NFSREQ, M_WAITOK);
sp = malloc(sizeof (struct sillyrename), M_NFSREQ, M_WAITOK);
sp->s_cred = crhold(cnp->cn_cred);
sp->s_dvp = dvp;
sp->s_removeit = nfs4_removeit;
@ -2352,7 +2351,7 @@ nfs4_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred,
np->n_namelen = len;
if (np->n_name != NULL)
free(np->n_name, M_NFSREQ);
np->n_name = malloc( np->n_namelen + 1, M_NFSREQ, M_WAITOK);
np->n_name = malloc(np->n_namelen + 1, M_NFSREQ, M_WAITOK);
memcpy(np->n_name, name, len);
np->n_name[len] = '\0';
}

View File

@ -281,7 +281,8 @@ nfs_dolock(struct vop_advlock_args *ap)
* if there is no nfsowner table yet, allocate one.
*/
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;
timevaladd(&p->p_nlminfo->pid_start, &boottime);
}

View File

@ -267,7 +267,8 @@ cryptof_ioctl(
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,
crie.cri_klen / 8)))
goto bail;
@ -284,7 +285,8 @@ cryptof_ioctl(
}
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,
cria.cri_klen / 8)))
goto bail;
@ -776,11 +778,9 @@ csecreate(struct fcrypt *fcr, u_int64_t sid, caddr_t key, u_int64_t keylen,
#ifdef INVARIANTS
/* NB: required when mtx_init is built with INVARIANTS */
cse = malloc(sizeof(struct csession),
M_XDATA, M_NOWAIT | M_ZERO);
cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT | M_ZERO);
#else
cse = malloc(sizeof(struct csession),
M_XDATA, M_NOWAIT);
cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT);
#endif
if (cse == NULL)
return NULL;
@ -840,7 +840,7 @@ cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread
switch (cmd) {
case CRIOGET:
fcr = malloc( sizeof(struct fcrypt), M_XDATA, M_WAITOK);
fcr = malloc(sizeof(struct fcrypt), M_XDATA, M_WAITOK);
TAILQ_INIT(&fcr->csessions);
fcr->sesn = 0;

View File

@ -152,7 +152,8 @@ sysctl_rule(SYSCTL_HANDLER_ARGS)
error = SYSCTL_IN(req, &temprule, sizeof(temprule));
if (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);

View File

@ -3920,7 +3920,8 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
if (inodedep->id_savedino1 != NULL)
panic("initiate_write_inodeblock_ufs1: I/O underway");
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);
inodedep->id_savedino1 = sip;
*inodedep->id_savedino1 = *dp;
@ -4065,7 +4066,8 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
if (inodedep->id_savedino2 != NULL)
panic("initiate_write_inodeblock_ufs2: I/O underway");
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);
inodedep->id_savedino2 = sip;
*inodedep->id_savedino2 = *dp;

View File

@ -588,7 +588,8 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
if (backing_vnode->v_type != VREG)
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)
return (ENOMEM);