Retire the MALLOC and FREE macros. They are an abomination unto style(9).

MFC after:	3 months
This commit is contained in:
des 2008-10-23 15:53:51 +00:00
parent a779c60ce0
commit 66f807ed8b
217 changed files with 1001 additions and 1073 deletions

View File

@ -758,11 +758,14 @@ buildkernel:
@echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
.endif
.if !defined(NO_KERNELOBJ)
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.2: rebuilding the object tree"
@echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
.endif
.if !defined(NO_KERNELTOOLS)
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.3: build tools"
@ -779,6 +782,7 @@ buildkernel:
${MAKE} -DWITHOUT_SSP -DNO_CPU_CFLAGS -DNO_CTF ${target}
.endfor
.endif
.endif
.if !defined(NO_KERNELDEPEND)
@echo
@echo "--------------------------------------------------------------"

View File

@ -741,9 +741,7 @@ MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
MLINKS+=make_dev.9 destroy_dev.9 \
make_dev.9 dev_depends.9 \
make_dev.9 make_dev_alias.9
MLINKS+=malloc.9 FREE.9 \
malloc.9 free.9 \
malloc.9 MALLOC.9 \
MLINKS+=malloc.9 free.9 \
malloc.9 MALLOC_DECLARE.9 \
malloc.9 MALLOC_DEFINE.9 \
malloc.9 realloc.9 \

View File

@ -36,14 +36,12 @@
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
.\" $FreeBSD$
.\"
.Dd June 12, 2003
.Dd October 23, 2008
.Dt MALLOC 9
.Os
.Sh NAME
.Nm malloc ,
.Nm MALLOC ,
.Nm free ,
.Nm FREE ,
.Nm realloc ,
.Nm reallocf ,
.Nm MALLOC_DEFINE ,
@ -54,10 +52,8 @@
.In sys/malloc.h
.Ft void *
.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags"
.Fn MALLOC space cast "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void
.Fn free "void *addr" "struct malloc_type *type"
.Fn FREE "void *addr" "struct malloc_type *type"
.Ft void *
.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void *
@ -123,20 +119,6 @@ function is identical to
except that it
will free the passed pointer when the requested memory cannot be allocated.
.Pp
The
.Fn MALLOC
macro variant is functionally equivalent to
.Bd -literal -offset indent
(space) = (cast)malloc((u_long)(size), type, flags)
.Ed
.Pp
and the
.Fn FREE
macro variant is equivalent to
.Bd -literal -offset indent
free((addr), type)
.Ed
.Pp
Unlike its standard C library counterpart
.Pq Xr malloc 3 ,
the kernel version takes two more arguments.
@ -219,7 +201,7 @@ MALLOC_DEFINE(M_FOOBUF, "foobuffers", "Buffers to foo data into the ether");
/* sys/something/foo_subr.c */
\&...
MALLOC(buf, struct foo_buf *, sizeof *buf, M_FOOBUF, M_NOWAIT);
buf = malloc(sizeof *buf, M_FOOBUF, M_NOWAIT);
.Ed
.Pp

View File

@ -106,7 +106,7 @@ install_coproc_handler(int coproc, undef_handler_t handler)
KASSERT(handler != NULL, ("handler is NULL")); /* Used to be legal. */
/* XXX: M_TEMP??? */
MALLOC(uh, struct undefined_handler *, sizeof(*uh), M_TEMP, M_WAITOK);
uh = malloc(sizeof(*uh), M_TEMP, M_WAITOK);
uh->uh_handler = handler;
install_coproc_handler_static(coproc, uh);
return uh;
@ -125,7 +125,7 @@ remove_coproc_handler(void *cookie)
struct undefined_handler *uh = cookie;
LIST_REMOVE(uh, uh_link);
FREE(uh, M_TEMP);
free(uh, M_TEMP);
}

View File

@ -183,7 +183,7 @@ targopen(struct cdev *dev, int flags, int fmt, struct thread *td)
make_dev(&targ_cdevsw, dev2unit(dev), UID_ROOT, GID_WHEEL, 0600,
"targ%d", dev2unit(dev));
}
MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG,
softc = malloc(sizeof(*softc), M_TARG,
M_WAITOK | M_ZERO);
dev->si_drv1 = softc;
softc->state = TARG_STATE_OPENED;
@ -211,7 +211,7 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
if ((softc->periph == NULL) ||
(softc->state & TARG_STATE_LUN_ENABLED) == 0) {
destroy_dev(dev);
FREE(softc, M_TARG);
free(softc, M_TARG);
return (0);
}
@ -230,7 +230,7 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
softc->periph = NULL;
}
destroy_dev(dev);
FREE(softc, M_TARG);
free(softc, M_TARG);
}
cam_periph_unlock(periph);
cam_periph_release(periph);
@ -531,7 +531,7 @@ targdtor(struct cam_periph *periph)
}
while ((descr = TAILQ_FIRST(&softc->abort_queue)) != NULL) {
TAILQ_REMOVE(&softc->abort_queue, descr, tqe);
FREE(descr, M_TARG);
free(descr, M_TARG);
}
softc->periph = NULL;
@ -966,7 +966,7 @@ targgetccb(struct targ_softc *softc, xpt_opcode type, int priority)
int ccb_len;
ccb_len = targccblen(type);
MALLOC(ccb, union ccb *, ccb_len, M_TARG, M_WAITOK);
ccb = malloc(ccb_len, M_TARG, M_WAITOK);
CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb));
xpt_setup_ccb(&ccb->ccb_h, softc->path, priority);
@ -981,13 +981,13 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb)
{
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("targfreeccb descr %p and\n",
ccb->ccb_h.targ_descr));
FREE(ccb->ccb_h.targ_descr, M_TARG);
free(ccb->ccb_h.targ_descr, M_TARG);
switch (ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO:
case XPT_IMMED_NOTIFY:
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb));
FREE(ccb, M_TARG);
free(ccb, M_TARG);
break;
default:
/* Send back CCB if we got it from the periph */
@ -998,7 +998,7 @@ targfreeccb(struct targ_softc *softc, union ccb *ccb)
} else {
CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH,
("freeing ccb %p\n", ccb));
FREE(ccb, M_TARG);
free(ccb, M_TARG);
}
break;
}
@ -1009,7 +1009,7 @@ targgetdescr(struct targ_softc *softc)
{
struct targ_cmd_descr *descr;
MALLOC(descr, struct targ_cmd_descr *, sizeof(*descr), M_TARG,
descr = malloc(sizeof(*descr), M_TARG,
M_WAITOK);
descr->mapinfo.num_bufs_used = 0;
return (descr);

View File

@ -2673,7 +2673,7 @@ linux_ioctl_register_handler(struct linux_ioctl_handler *h)
break;
}
if (he == NULL) {
MALLOC(he, struct handler_element *, sizeof(*he),
he = malloc(sizeof(*he),
M_LINUX, M_WAITOK);
he->func = h->func;
} else
@ -2711,7 +2711,7 @@ linux_ioctl_unregister_handler(struct linux_ioctl_handler *h)
if (he->func == h->func) {
TAILQ_REMOVE(&handlers, he, list);
sx_xunlock(&linux_ioctl_sx);
FREE(he, M_LINUX);
free(he, M_LINUX);
return (0);
}
}

View File

@ -120,7 +120,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
}
#endif
MALLOC(kosa, struct osockaddr *, alloclen, mtype, M_WAITOK);
kosa = malloc(alloclen, mtype, M_WAITOK);
if ((error = copyin(osa, kosa, *osalen)))
goto out;
@ -168,7 +168,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
return (0);
out:
FREE(kosa, mtype);
free(kosa, mtype);
return (error);
}
@ -458,7 +458,7 @@ linux_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
bad:
if (to)
FREE(to, M_SONAME);
free(to, M_SONAME);
return (error);
}

View File

@ -165,7 +165,7 @@ linux_get_char_devices()
char formated[256];
int current_size = 0, string_size = 1024;
MALLOC(string, char *, string_size, M_LINUX, M_WAITOK);
string = malloc(string_size, M_LINUX, M_WAITOK);
string[0] = '\000';
last = "";
TAILQ_FOREACH(de, &devices, list) {
@ -181,10 +181,10 @@ linux_get_char_devices()
if (strlen(formated) + current_size
>= string_size) {
string_size *= 2;
MALLOC(string, char *, string_size,
string = malloc(string_size,
M_LINUX, M_WAITOK);
bcopy(temp, string, current_size);
FREE(temp, M_LINUX);
free(temp, M_LINUX);
}
strcat(string, formated);
current_size = strlen(string);
@ -197,7 +197,7 @@ linux_get_char_devices()
void
linux_free_get_char_devices(char *string)
{
FREE(string, M_LINUX);
free(string, M_LINUX);
}
static int linux_major_starting = 200;
@ -210,7 +210,7 @@ linux_device_register_handler(struct linux_device_handler *d)
if (d == NULL)
return (EINVAL);
MALLOC(de, struct device_element *, sizeof(*de),
de = malloc(sizeof(*de),
M_LINUX, M_WAITOK);
if (d->linux_major < 0) {
d->linux_major = linux_major_starting++;
@ -234,7 +234,7 @@ linux_device_unregister_handler(struct linux_device_handler *d)
TAILQ_FOREACH(de, &devices, list) {
if (bcmp(d, &de->entry, sizeof(*d)) == 0) {
TAILQ_REMOVE(&devices, de, list);
FREE(de, M_LINUX);
free(de, M_LINUX);
return (0);
}
}

View File

@ -273,7 +273,7 @@ cbq_add_altq(struct pf_altq *a)
return (ENODEV);
/* allocate and initialize cbq_state_t */
MALLOC(cbqp, cbq_state_t *, sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
if (cbqp == NULL)
return (ENOMEM);
bzero(cbqp, sizeof(cbq_state_t));
@ -304,7 +304,7 @@ cbq_remove_altq(struct pf_altq *a)
cbq_class_destroy(cbqp, cbqp->ifnp.root_);
/* deallocate cbq_state_t */
FREE(cbqp, M_DEVBUF);
free(cbqp, M_DEVBUF);
return (0);
}
@ -927,7 +927,7 @@ cbq_ifattach(ifacep)
return (ENXIO);
/* allocate and initialize cbq_state_t */
MALLOC(new_cbqp, cbq_state_t *, sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
new_cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
if (new_cbqp == NULL)
return (ENOMEM);
bzero(new_cbqp, sizeof(cbq_state_t));
@ -943,7 +943,7 @@ cbq_ifattach(ifacep)
cbq_enqueue, cbq_dequeue, cbq_request,
&new_cbqp->cbq_classifier, acc_classify);
if (error) {
FREE(new_cbqp, M_DEVBUF);
free(new_cbqp, M_DEVBUF);
return (error);
}
@ -987,7 +987,7 @@ cbq_ifdetach(ifacep)
}
/* deallocate cbq_state_t */
FREE(cbqp, M_DEVBUF);
free(cbqp, M_DEVBUF);
return (0);
}

View File

@ -274,7 +274,7 @@ cdnr_cballoc(top, type, input_func)
return (NULL);
}
MALLOC(cb, struct cdnr_block *, size, M_DEVBUF, M_WAITOK);
cb = malloc(size, M_DEVBUF, M_WAITOK);
if (cb == NULL)
return (NULL);
bzero(cb, size);
@ -319,7 +319,7 @@ cdnr_cbdestroy(cblock)
if (cb->cb_top != cblock)
LIST_REMOVE(cb, cb_next);
FREE(cb, M_DEVBUF);
free(cb, M_DEVBUF);
}
/*

View File

@ -202,7 +202,7 @@ hfsc_add_altq(struct pf_altq *a)
if (!ALTQ_IS_READY(&ifp->if_snd))
return (ENODEV);
MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if),
hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK);
if (hif == NULL)
return (ENOMEM);
@ -210,7 +210,7 @@ hfsc_add_altq(struct pf_altq *a)
hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) {
FREE(hif, M_DEVBUF);
free(hif, M_DEVBUF);
return (ENOMEM);
}
@ -236,7 +236,7 @@ hfsc_remove_altq(struct pf_altq *a)
ellist_destroy(hif->hif_eligible);
FREE(hif, M_DEVBUF);
free(hif, M_DEVBUF);
return (0);
}
@ -404,13 +404,13 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
}
#endif
MALLOC(cl, struct hfsc_class *, sizeof(struct hfsc_class),
cl = malloc(sizeof(struct hfsc_class),
M_DEVBUF, M_WAITOK);
if (cl == NULL)
return (NULL);
bzero(cl, sizeof(struct hfsc_class));
MALLOC(cl->cl_q, class_queue_t *, sizeof(class_queue_t),
cl->cl_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
if (cl->cl_q == NULL)
goto err_ret;
@ -471,8 +471,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
#endif /* ALTQ_RED */
if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) {
MALLOC(cl->cl_rsc, struct internal_sc *,
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);
@ -480,16 +479,14 @@ 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)) {
MALLOC(cl->cl_fsc, struct internal_sc *,
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)) {
MALLOC(cl->cl_usc, struct internal_sc *,
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);
@ -565,14 +562,14 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
#endif
}
if (cl->cl_fsc != NULL)
FREE(cl->cl_fsc, M_DEVBUF);
free(cl->cl_fsc, M_DEVBUF);
if (cl->cl_rsc != NULL)
FREE(cl->cl_rsc, M_DEVBUF);
free(cl->cl_rsc, M_DEVBUF);
if (cl->cl_usc != NULL)
FREE(cl->cl_usc, M_DEVBUF);
free(cl->cl_usc, M_DEVBUF);
if (cl->cl_q != NULL)
FREE(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF);
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
return (NULL);
}
@ -649,13 +646,13 @@ hfsc_class_destroy(struct hfsc_class *cl)
IFQ_UNLOCK(cl->cl_hif->hif_ifq);
if (cl->cl_usc != NULL)
FREE(cl->cl_usc, M_DEVBUF);
free(cl->cl_usc, M_DEVBUF);
if (cl->cl_fsc != NULL)
FREE(cl->cl_fsc, M_DEVBUF);
free(cl->cl_fsc, M_DEVBUF);
if (cl->cl_rsc != NULL)
FREE(cl->cl_rsc, M_DEVBUF);
FREE(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF);
free(cl->cl_rsc, M_DEVBUF);
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
return (0);
}
@ -1203,7 +1200,7 @@ ellist_alloc(void)
{
ellist_t *head;
MALLOC(head, ellist_t *, sizeof(ellist_t), M_DEVBUF, M_WAITOK);
head = malloc(sizeof(ellist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head);
return (head);
}
@ -1211,7 +1208,7 @@ ellist_alloc(void)
static void
ellist_destroy(ellist_t *head)
{
FREE(head, M_DEVBUF);
free(head, M_DEVBUF);
}
static void
@ -1306,7 +1303,7 @@ actlist_alloc(void)
{
actlist_t *head;
MALLOC(head, actlist_t *, sizeof(actlist_t), M_DEVBUF, M_WAITOK);
head = malloc(sizeof(actlist_t), M_DEVBUF, M_WAITOK);
TAILQ_INIT(head);
return (head);
}
@ -1314,7 +1311,7 @@ actlist_alloc(void)
static void
actlist_destroy(actlist_t *head)
{
FREE(head, M_DEVBUF);
free(head, M_DEVBUF);
}
static void
actlist_insert(struct hfsc_class *cl)
@ -1743,7 +1740,7 @@ hfsc_attach(ifq, bandwidth)
{
struct hfsc_if *hif;
MALLOC(hif, struct hfsc_if *, sizeof(struct hfsc_if),
hif = malloc(sizeof(struct hfsc_if),
M_DEVBUF, M_WAITOK);
if (hif == NULL)
return (NULL);
@ -1751,7 +1748,7 @@ hfsc_attach(ifq, bandwidth)
hif->hif_eligible = ellist_alloc();
if (hif->hif_eligible == NULL) {
FREE(hif, M_DEVBUF);
free(hif, M_DEVBUF);
return NULL;
}
@ -1787,7 +1784,7 @@ hfsc_detach(hif)
ellist_destroy(hif->hif_eligible);
FREE(hif, M_DEVBUF);
free(hif, M_DEVBUF);
return (0);
}
@ -1804,22 +1801,19 @@ 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) {
MALLOC(rsc_tmp, struct internal_sc *,
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) {
MALLOC(fsc_tmp, struct internal_sc *,
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) {
MALLOC(usc_tmp, struct internal_sc *,
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);
}
@ -1837,7 +1831,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (cl->cl_rsc != NULL) {
if (!qempty(cl->cl_q))
hfsc_purgeq(cl);
FREE(cl->cl_rsc, M_DEVBUF);
free(cl->cl_rsc, M_DEVBUF);
cl->cl_rsc = NULL;
}
} else {
@ -1859,7 +1853,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (cl->cl_fsc != NULL) {
if (!qempty(cl->cl_q))
hfsc_purgeq(cl);
FREE(cl->cl_fsc, M_DEVBUF);
free(cl->cl_fsc, M_DEVBUF);
cl->cl_fsc = NULL;
}
} else {
@ -1874,7 +1868,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
if (usc != NULL) {
if (usc->m1 == 0 && usc->m2 == 0) {
if (cl->cl_usc != NULL) {
FREE(cl->cl_usc, M_DEVBUF);
free(cl->cl_usc, M_DEVBUF);
cl->cl_usc = NULL;
cl->cl_myf = 0;
}

View File

@ -134,7 +134,7 @@ priq_add_altq(struct pf_altq *a)
if (!ALTQ_IS_READY(&ifp->if_snd))
return (ENODEV);
MALLOC(pif, struct priq_if *, sizeof(struct priq_if),
pif = malloc(sizeof(struct priq_if),
M_DEVBUF, M_WAITOK);
if (pif == NULL)
return (ENOMEM);
@ -160,7 +160,7 @@ priq_remove_altq(struct pf_altq *a)
(void)priq_clear_interface(pif);
FREE(pif, M_DEVBUF);
free(pif, M_DEVBUF);
return (0);
}
@ -320,13 +320,13 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid)
red_destroy(cl->cl_red);
#endif
} else {
MALLOC(cl, struct priq_class *, sizeof(struct priq_class),
cl = malloc(sizeof(struct priq_class),
M_DEVBUF, M_WAITOK);
if (cl == NULL)
return (NULL);
bzero(cl, sizeof(struct priq_class));
MALLOC(cl->cl_q, class_queue_t *, sizeof(class_queue_t),
cl->cl_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
if (cl->cl_q == NULL)
goto err_ret;
@ -397,8 +397,8 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid)
#endif
}
if (cl->cl_q != NULL)
FREE(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF);
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
return (NULL);
}
@ -447,8 +447,8 @@ priq_class_destroy(struct priq_class *cl)
red_destroy(cl->cl_red);
#endif
}
FREE(cl->cl_q, M_DEVBUF);
FREE(cl, M_DEVBUF);
free(cl->cl_q, M_DEVBUF);
free(cl, M_DEVBUF);
return (0);
}
@ -666,7 +666,7 @@ priq_attach(ifq, bandwidth)
{
struct priq_if *pif;
MALLOC(pif, struct priq_if *, sizeof(struct priq_if),
pif = malloc(sizeof(struct priq_if),
M_DEVBUF, M_WAITOK);
if (pif == NULL)
return (NULL);
@ -702,7 +702,7 @@ priq_detach(pif)
ASSERT(p != NULL);
}
FREE(pif, M_DEVBUF);
free(pif, M_DEVBUF);
return (0);
}

View File

@ -233,7 +233,7 @@ red_alloc(int weight, int inv_pmax, int th_min, int th_max, int flags,
int w, i;
int npkts_per_sec;
MALLOC(rp, red_t *, sizeof(red_t), M_DEVBUF, M_WAITOK);
rp = malloc(sizeof(red_t), M_DEVBUF, M_WAITOK);
if (rp == NULL)
return (NULL);
bzero(rp, sizeof(red_t));
@ -321,7 +321,7 @@ red_destroy(red_t *rp)
#endif
#endif /* ALTQ3_COMPAT */
wtab_destroy(rp->red_wtab);
FREE(rp, M_DEVBUF);
free(rp, M_DEVBUF);
}
void
@ -646,7 +646,7 @@ wtab_alloc(int weight)
return (w);
}
MALLOC(w, struct wtab *, sizeof(struct wtab), M_DEVBUF, M_WAITOK);
w = malloc(sizeof(struct wtab), M_DEVBUF, M_WAITOK);
if (w == NULL)
panic("wtab_alloc: malloc failed!");
bzero(w, sizeof(struct wtab));
@ -682,7 +682,7 @@ wtab_destroy(struct wtab *w)
break;
}
FREE(w, M_DEVBUF);
free(w, M_DEVBUF);
return (0);
}
@ -816,17 +816,17 @@ redioctl(dev, cmd, addr, flag, p)
}
/* allocate and initialize red_queue_t */
MALLOC(rqp, red_queue_t *, sizeof(red_queue_t), M_DEVBUF, M_WAITOK);
rqp = malloc(sizeof(red_queue_t), M_DEVBUF, M_WAITOK);
if (rqp == NULL) {
error = ENOMEM;
break;
}
bzero(rqp, sizeof(red_queue_t));
MALLOC(rqp->rq_q, class_queue_t *, sizeof(class_queue_t),
rqp->rq_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
if (rqp->rq_q == NULL) {
FREE(rqp, M_DEVBUF);
free(rqp, M_DEVBUF);
error = ENOMEM;
break;
}
@ -834,8 +834,8 @@ redioctl(dev, cmd, addr, flag, p)
rqp->rq_red = red_alloc(0, 0, 0, 0, 0, 0);
if (rqp->rq_red == NULL) {
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
error = ENOMEM;
break;
}
@ -854,8 +854,8 @@ redioctl(dev, cmd, addr, flag, p)
NULL, NULL);
if (error) {
red_destroy(rqp->rq_red);
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
break;
}
@ -1016,8 +1016,8 @@ red_detach(rqp)
}
red_destroy(rqp->rq_red);
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
return (error);
}
@ -1297,16 +1297,16 @@ fv_alloc(rp)
int i, num;
num = FV_FLOWLISTSIZE;
MALLOC(fv, struct flowvalve *, sizeof(struct flowvalve),
fv = malloc(sizeof(struct flowvalve),
M_DEVBUF, M_WAITOK);
if (fv == NULL)
return (NULL);
bzero(fv, sizeof(struct flowvalve));
MALLOC(fv->fv_fves, struct fve *, sizeof(struct fve) * num,
fv->fv_fves = malloc(sizeof(struct fve) * num,
M_DEVBUF, M_WAITOK);
if (fv->fv_fves == NULL) {
FREE(fv, M_DEVBUF);
free(fv, M_DEVBUF);
return (NULL);
}
bzero(fv->fv_fves, sizeof(struct fve) * num);
@ -1323,11 +1323,11 @@ fv_alloc(rp)
fv->fv_pthresh = (FV_PSCALE(1) << FP_SHIFT) / rp->red_inv_pmax;
/* initialize drop rate to fraction table */
MALLOC(fv->fv_p2ftab, int *, sizeof(int) * BRTT_SIZE,
fv->fv_p2ftab = malloc(sizeof(int) * BRTT_SIZE,
M_DEVBUF, M_WAITOK);
if (fv->fv_p2ftab == NULL) {
FREE(fv->fv_fves, M_DEVBUF);
FREE(fv, M_DEVBUF);
free(fv->fv_fves, M_DEVBUF);
free(fv, M_DEVBUF);
return (NULL);
}
/*
@ -1348,9 +1348,9 @@ fv_alloc(rp)
static void fv_destroy(fv)
struct flowvalve *fv;
{
FREE(fv->fv_p2ftab, M_DEVBUF);
FREE(fv->fv_fves, M_DEVBUF);
FREE(fv, M_DEVBUF);
free(fv->fv_p2ftab, M_DEVBUF);
free(fv->fv_fves, M_DEVBUF);
free(fv, M_DEVBUF);
}
static __inline int

View File

@ -206,7 +206,7 @@ rio_alloc(int weight, struct redparams *params, int flags, int pkttime)
int w, i;
int npkts_per_sec;
MALLOC(rp, rio_t *, sizeof(rio_t), M_DEVBUF, M_WAITOK);
rp = malloc(sizeof(rio_t), M_DEVBUF, M_WAITOK);
if (rp == NULL)
return (NULL);
bzero(rp, sizeof(rio_t));
@ -293,7 +293,7 @@ void
rio_destroy(rio_t *rp)
{
wtab_destroy(rp->rio_wtab);
FREE(rp, M_DEVBUF);
free(rp, M_DEVBUF);
}
void
@ -572,17 +572,17 @@ rioioctl(dev, cmd, addr, flag, p)
}
/* allocate and initialize rio_queue_t */
MALLOC(rqp, rio_queue_t *, sizeof(rio_queue_t), M_DEVBUF, M_WAITOK);
rqp = malloc(sizeof(rio_queue_t), M_DEVBUF, M_WAITOK);
if (rqp == NULL) {
error = ENOMEM;
break;
}
bzero(rqp, sizeof(rio_queue_t));
MALLOC(rqp->rq_q, class_queue_t *, sizeof(class_queue_t),
rqp->rq_q = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
if (rqp->rq_q == NULL) {
FREE(rqp, M_DEVBUF);
free(rqp, M_DEVBUF);
error = ENOMEM;
break;
}
@ -590,8 +590,8 @@ rioioctl(dev, cmd, addr, flag, p)
rqp->rq_rio = rio_alloc(0, NULL, 0, 0);
if (rqp->rq_rio == NULL) {
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
error = ENOMEM;
break;
}
@ -610,8 +610,8 @@ rioioctl(dev, cmd, addr, flag, p)
NULL, NULL);
if (error) {
rio_destroy(rqp->rq_rio);
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
break;
}
@ -759,8 +759,8 @@ rio_detach(rqp)
}
rio_destroy(rqp->rq_rio);
FREE(rqp->rq_q, M_DEVBUF);
FREE(rqp, M_DEVBUF);
free(rqp->rq_q, M_DEVBUF);
free(rqp, M_DEVBUF);
return (error);
}

View File

@ -220,16 +220,16 @@ rmc_newclass(int pri, struct rm_ifdat *ifd, u_int nsecPerByte,
}
#endif
MALLOC(cl, struct rm_class *, sizeof(struct rm_class),
cl = malloc(sizeof(struct rm_class),
M_DEVBUF, M_WAITOK);
if (cl == NULL)
return (NULL);
bzero(cl, sizeof(struct rm_class));
CALLOUT_INIT(&cl->callout_);
MALLOC(cl->q_, class_queue_t *, sizeof(class_queue_t),
cl->q_ = malloc(sizeof(class_queue_t),
M_DEVBUF, M_WAITOK);
if (cl->q_ == NULL) {
FREE(cl, M_DEVBUF);
free(cl, M_DEVBUF);
return (NULL);
}
bzero(cl->q_, sizeof(class_queue_t));
@ -658,8 +658,8 @@ rmc_delete_class(struct rm_ifdat *ifd, struct rm_class *cl)
red_destroy(cl->red_);
#endif
}
FREE(cl->q_, M_DEVBUF);
FREE(cl, M_DEVBUF);
free(cl->q_, M_DEVBUF);
free(cl, M_DEVBUF);
}

View File

@ -397,13 +397,13 @@ tbr_set(ifq, profile)
return (ENOENT);
}
ifq->altq_tbr = NULL;
FREE(tbr, M_DEVBUF);
free(tbr, M_DEVBUF);
IFQ_UNLOCK(ifq);
return (0);
}
IFQ_UNLOCK(ifq);
MALLOC(tbr, struct tb_regulator *, sizeof(struct tb_regulator),
tbr = malloc(sizeof(struct tb_regulator),
M_DEVBUF, M_WAITOK);
if (tbr == NULL) { /* can not happen */
IFQ_UNLOCK(ifq);
@ -426,7 +426,7 @@ tbr_set(ifq, profile)
ifq->altq_tbr = tbr; /* set the new tbr */
if (otbr != NULL)
FREE(otbr, M_DEVBUF);
free(otbr, M_DEVBUF);
else {
if (tbr_timer == 0) {
CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0);
@ -1402,7 +1402,7 @@ acc_add_filter(classifier, filter, class, phandle)
return (EINVAL);
#endif
MALLOC(afp, struct acc_filter *, sizeof(struct acc_filter),
afp = malloc(sizeof(struct acc_filter),
M_DEVBUF, M_WAITOK);
if (afp == NULL)
return (ENOMEM);
@ -1529,7 +1529,7 @@ acc_delete_filter(classifier, handle)
LIST_REMOVE(afp, f_chain);
splx(s);
FREE(afp, M_DEVBUF);
free(afp, M_DEVBUF);
/* todo: update filt_bmask */
@ -1559,7 +1559,7 @@ acc_discard_filters(classifier, class, all)
LIST_FOREACH(afp, &classifier->acc_filters[i], f_chain)
if (all || afp->f_class == class) {
LIST_REMOVE(afp, f_chain);
FREE(afp, M_DEVBUF);
free(afp, M_DEVBUF);
/* start again from the head */
break;
}
@ -1981,7 +1981,7 @@ ip4f_init(void)
TAILQ_INIT(&ip4f_list);
for (i=0; i<IP4F_TABSIZE; i++) {
MALLOC(fp, struct ip4_frag *, sizeof(struct ip4_frag),
fp = malloc(sizeof(struct ip4_frag),
M_DEVBUF, M_NOWAIT);
if (fp == NULL) {
printf("ip4f_init: can't alloc %dth entry!\n", i);

View File

@ -1662,12 +1662,23 @@ MALLOC_DECLARE(M_IPFILTER);
# endif /* M_IPFILTER */
# endif /* M_PFIL */
# endif /* IPFILTER_M_IPFILTER */
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
# if !defined(KMALLOCS)
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
# if defined(__FreeBSD__) && __FreeBSD_version >= 800051
# define KMALLOC(a, b) do { \
a = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT); \
} while (0)
# define KMALLOCS(a, b, c) do { \
a = (b)malloc((c), _M_IPF, ((c) > 4096) ? M_WAITOK : M_NOWAIT); \
} while (0)
# define KFREE(x) free((x), _M_IPF)
# define KFREES(x,s) free((x), _M_IPF)
# else
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
# if !defined(KMALLOCS)
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
# endif
# define KFREE(x) FREE((x), _M_IPF)
# define KFREES(x,s) FREE((x), _M_IPF)
# endif
# define KFREE(x) FREE((x), _M_IPF)
# define KFREES(x,s) FREE((x), _M_IPF)
# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d)
# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
# define WAKEUP(id,x) wakeup(id+x)

View File

@ -365,7 +365,7 @@ ar_detach(device_t device)
* deallocate any system resources we may have
* allocated on behalf of this driver.
*/
FREE(hc->sc, M_DEVBUF);
free(hc->sc, M_DEVBUF);
hc->sc = NULL;
hc->mem_start = NULL;
return (ar_deallocate_resources(device));
@ -1071,7 +1071,7 @@ arc_init(struct ar_hardc *hc)
u_char isr, mar;
u_long memst;
MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc),
sc = malloc(hc->numports * sizeof(struct ar_softc),
M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL)
return;

View File

@ -2366,8 +2366,7 @@ static int ng_ce_rcvmsg (node_p node, struct ng_mesg *msg,
break;
}
#else
MALLOC (resp, struct ng_mesg *, dl,
M_NETGRAPH, M_NOWAIT);
resp = malloc (M_NETGRAPH, M_NOWAIT);
if (! resp) {
error = ENOMEM;
break;
@ -2400,7 +2399,7 @@ static int ng_ce_rcvmsg (node_p node, struct ng_mesg *msg,
NG_FREE_MSG (msg);
#else
*rptr = resp;
FREE (msg, M_NETGRAPH);
free (msg, M_NETGRAPH);
#endif
return error;
}

View File

@ -838,7 +838,7 @@ amd_init(int cpu)
PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu);
MALLOC(pcs, struct amd_cpu *, sizeof(struct amd_cpu), M_PMC,
pcs = malloc(sizeof(struct amd_cpu), M_PMC,
M_WAITOK|M_ZERO);
phw = &pcs->pc_amdpmcs[0];
@ -911,7 +911,7 @@ amd_cleanup(int cpu)
#endif
pmc_pcpu[cpu] = NULL;
FREE(pcs, M_PMC);
free(pcs, M_PMC);
return 0;
}
@ -960,7 +960,7 @@ pmc_amd_initialize(void)
amd_pmc_class = class;
#endif
MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep),
pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype;

View File

@ -973,7 +973,7 @@ pmclog_initialize()
/* create global pool of log buffers */
for (n = 0; n < pmc_nlogbuffers; n++) {
MALLOC(plb, struct pmclog_buffer *, 1024 * pmclog_buffer_size,
plb = malloc(1024 * pmclog_buffer_size,
M_PMC, M_ZERO|M_WAITOK);
PMCLOG_INIT_BUFFER_DESCRIPTOR(plb);
TAILQ_INSERT_HEAD(&pmc_bufferlist, plb, plb_next);
@ -999,6 +999,6 @@ pmclog_shutdown()
while ((plb = TAILQ_FIRST(&pmc_bufferlist)) != NULL) {
TAILQ_REMOVE(&pmc_bufferlist, plb, plb_next);
FREE(plb, M_PMC);
free(plb, M_PMC);
}
}

View File

@ -331,7 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
int error, found, *newbits, tmp;
size_t kwlen;
MALLOC(tmpflags, struct pmc_debugflags *, sizeof(*tmpflags),
tmpflags = malloc(sizeof(*tmpflags),
M_PMC, M_WAITOK|M_ZERO);
p = newstr;
@ -450,7 +450,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
bcopy(tmpflags, &pmc_debugflags, sizeof(pmc_debugflags));
done:
FREE(tmpflags, M_PMC);
free(tmpflags, M_PMC);
return error;
}
@ -464,7 +464,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
(void) arg1; (void) arg2; /* unused parameters */
n = sizeof(pmc_debugstr);
MALLOC(newstr, char *, n, M_PMC, M_ZERO|M_WAITOK);
newstr = malloc(n, M_PMC, M_ZERO|M_WAITOK);
(void) strlcpy(newstr, pmc_debugstr, n);
error = sysctl_handle_string(oidp, newstr, n, req);
@ -477,7 +477,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
sizeof(pmc_debugstr));
}
FREE(newstr, M_PMC);
free(newstr, M_PMC);
return error;
}
@ -777,7 +777,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
__LINE__, pp, pm));
#endif
MALLOC(pt, struct pmc_target *, sizeof(struct pmc_target),
pt = malloc(sizeof(struct pmc_target),
M_PMC, M_ZERO|M_WAITOK);
pt->pt_process = pp;
@ -849,7 +849,7 @@ pmc_unlink_target_process(struct pmc *pm, struct pmc_process *pp)
"in pmc %p", __LINE__, pp->pp_proc, pp, pm));
LIST_REMOVE(ptgt, pt_next);
FREE(ptgt, M_PMC);
free(ptgt, M_PMC);
/* if the PMC now lacks targets, send the owner a SIGIO */
if (LIST_EMPTY(&pm->pm_targets)) {
@ -972,7 +972,7 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm)
} else
pmclog_process_pmcattach(pm, p->p_pid, fullpath);
if (freepath)
FREE(freepath, M_TEMP);
free(freepath, M_TEMP);
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
pmc_log_process_mappings(pm->pm_owner, p);
}
@ -1093,7 +1093,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags)
pmc_remove_process_descriptor(pp);
if (flags & PMC_FLAG_REMOVE)
FREE(pp, M_PMC);
free(pp, M_PMC);
PROC_LOCK(p);
p->p_flag &= ~P_HWPMC;
@ -1511,7 +1511,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map_in *pkm)
done:
if (freepath)
FREE(freepath, M_TEMP);
free(freepath, M_TEMP);
}
@ -1575,7 +1575,7 @@ pmc_log_kernel_mappings(struct pmc *pm)
pmclog_process_map_in(po, (pid_t) -1, km->pm_address,
km->pm_file);
}
FREE(kmbase, M_LINKER);
free(kmbase, M_LINKER);
po->po_flags |= PMC_PO_INITIAL_MAPPINGS_DONE;
}
@ -1692,7 +1692,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (!is_using_hwpmcs) {
if (freepath)
FREE(freepath, M_TEMP);
free(freepath, M_TEMP);
break;
}
@ -1712,7 +1712,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
*/
if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) {
if (freepath)
FREE(freepath, M_TEMP);
free(freepath, M_TEMP);
break;
}
@ -1732,7 +1732,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
}
if (freepath)
FREE(freepath, M_TEMP);
free(freepath, M_TEMP);
PMCDBG(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d",
@ -1765,7 +1765,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp);
FREE(pp, M_PMC);
free(pp, M_PMC);
break;
}
@ -1861,7 +1861,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
poh = &pmc_ownerhash[hindex];
/* allocate space for N pointers and one descriptor struct */
MALLOC(po, struct pmc_owner *, sizeof(struct pmc_owner),
po = malloc(sizeof(struct pmc_owner),
M_PMC, M_ZERO|M_WAITOK);
po->po_sscount = po->po_error = po->po_flags = 0;
@ -1888,7 +1888,7 @@ pmc_destroy_owner_descriptor(struct pmc_owner *po)
po, po->po_owner, po->po_owner->p_pid, po->po_owner->p_comm);
mtx_destroy(&po->po_mtx);
FREE(po, M_PMC);
free(po, M_PMC);
}
/*
@ -1915,8 +1915,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
if (mode & PMC_FLAG_ALLOCATE) {
/* allocate additional space for 'n' pmc pointers */
MALLOC(ppnew, struct pmc_process *,
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);
}
@ -1938,7 +1937,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
mtx_unlock_spin(&pmc_processhash_mtx);
if (pp != NULL && ppnew != NULL)
FREE(ppnew, M_PMC);
free(ppnew, M_PMC);
return pp;
}
@ -1997,7 +1996,7 @@ pmc_allocate_pmc_descriptor(void)
{
struct pmc *pmc;
MALLOC(pmc, struct pmc *, sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK);
pmc = malloc(sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK);
if (pmc != NULL) {
pmc->pm_owner = NULL;
@ -2187,7 +2186,7 @@ pmc_release_pmc_descriptor(struct pmc *pm)
if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp);
FREE(pp, M_PMC);
free(pp, M_PMC);
}
}
@ -2819,7 +2818,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
npmc = md->pmd_npmc;
pmcinfo_size = npmc * sizeof(struct pmc_info);
MALLOC(pmcinfo, struct pmc_info *, pmcinfo_size, M_PMC,
pmcinfo = malloc(pmcinfo_size, M_PMC,
M_WAITOK);
p = pmcinfo;
@ -2863,7 +2862,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (error == 0)
error = copyout(pmcinfo, &gpi->pm_pmcs, pmcinfo_size);
FREE(pmcinfo, M_PMC);
free(pmcinfo, M_PMC);
}
break;
@ -3127,7 +3126,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (n == (int) md->pmd_npmc) {
pmc_destroy_pmc_descriptor(pmc);
FREE(pmc, M_PMC);
free(pmc, M_PMC);
pmc = NULL;
error = EINVAL;
break;
@ -3162,7 +3161,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
(error = md->pmd_config_pmc(cpu, n, pmc)) != 0) {
(void) md->pmd_release_pmc(cpu, n, pmc);
pmc_destroy_pmc_descriptor(pmc);
FREE(pmc, M_PMC);
free(pmc, M_PMC);
pmc = NULL;
pmc_restore_cpu_binding(&pb);
error = EPERM;
@ -3190,7 +3189,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if ((error =
pmc_register_owner(curthread->td_proc, pmc)) != 0) {
pmc_release_pmc_descriptor(pmc);
FREE(pmc, M_PMC);
free(pmc, M_PMC);
pmc = NULL;
break;
}
@ -3432,7 +3431,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
pmc_release_pmc_descriptor(pm);
pmc_maybe_remove_owner(po);
FREE(pm, M_PMC);
free(pm, M_PMC);
}
break;
@ -4167,7 +4166,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
pmclog_process_procexit(pm, pp);
pmc_unlink_target_process(pm, pp);
}
FREE(pp, M_PMC);
free(pp, M_PMC);
} else
critical_exit(); /* pp == NULL */
@ -4353,12 +4352,11 @@ pmc_initialize(void)
maxcpu = pmc_cpu_max();
/* allocate space for the per-cpu array */
MALLOC(pmc_pcpu, struct pmc_cpu **, maxcpu * sizeof(struct pmc_cpu *),
pmc_pcpu = malloc(maxcpu * sizeof(struct pmc_cpu *),
M_PMC, M_WAITOK|M_ZERO);
/* per-cpu 'saved values' for managing process-mode PMCs */
MALLOC(pmc_pcpu_saved, pmc_value_t *,
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);
@ -4378,8 +4376,7 @@ pmc_initialize(void)
for (cpu = 0; cpu < maxcpu; cpu++) {
if (!pmc_cpu_is_active(cpu))
continue;
MALLOC(sb, struct pmc_samplebuffer *,
sizeof(struct pmc_samplebuffer) +
sb = malloc( sizeof(struct pmc_samplebuffer) +
pmc_nsamples * sizeof(struct pmc_sample), M_PMC,
M_WAITOK|M_ZERO);
@ -4388,8 +4385,7 @@ pmc_initialize(void)
KASSERT(pmc_pcpu[cpu] != NULL,
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
MALLOC(sb->ps_callchains, uintptr_t *,
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++)
@ -4554,8 +4550,8 @@ pmc_cleanup(void)
KASSERT(pmc_pcpu[cpu]->pc_sb != NULL,
("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__,
cpu));
FREE(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC);
FREE(pmc_pcpu[cpu]->pc_sb, M_PMC);
free(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC);
free(pmc_pcpu[cpu]->pc_sb, M_PMC);
pmc_pcpu[cpu]->pc_sb = NULL;
}
@ -4572,20 +4568,20 @@ pmc_cleanup(void)
if (md->pmd_cleanup)
md->pmd_cleanup(cpu);
}
FREE(md, M_PMC);
free(md, M_PMC);
md = NULL;
pmc_restore_cpu_binding(&pb);
}
/* deallocate per-cpu structures */
FREE(pmc_pcpu, M_PMC);
free(pmc_pcpu, M_PMC);
pmc_pcpu = NULL;
FREE(pmc_pcpu_saved, M_PMC);
free(pmc_pcpu_saved, M_PMC);
pmc_pcpu_saved = NULL;
if (pmc_pmcdisp) {
FREE(pmc_pmcdisp, M_PMC);
free(pmc_pmcdisp, M_PMC);
pmc_pmcdisp = NULL;
}

View File

@ -628,8 +628,7 @@ p4_init(int cpu)
if (pcs == NULL) /* decline to init */
return ENXIO;
MALLOC(plcs, struct p4_logicalcpu *,
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;
@ -645,7 +644,7 @@ p4_init(int cpu)
return 0;
}
MALLOC(pcs, struct p4_cpu *, sizeof(struct p4_cpu), M_PMC,
pcs = malloc(sizeof(struct p4_cpu), M_PMC,
M_WAITOK|M_ZERO);
if (pcs == NULL)
@ -699,7 +698,7 @@ p4_cleanup(int cpu)
if (!P4_CPU_IS_HTT_SECONDARY(cpu))
mtx_destroy(&pcs->pc_mtx);
FREE(pcs, M_PMC);
free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL;
@ -1081,7 +1080,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
/*
* If the system has HTT enabled, and the desired allocation
* mode is process-private, and the PMC row disposition is not
* FREE (0), decline the allocation.
* free (0), decline the allocation.
*/
if (p4_system_has_htt &&

View File

@ -349,7 +349,7 @@ p6_init(int cpu)
PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu);
MALLOC(pcs, struct p6_cpu *, sizeof(struct p6_cpu), M_PMC,
pcs = malloc(sizeof(struct p6_cpu), M_PMC,
M_WAITOK|M_ZERO);
phw = pcs->pc_p6pmcs;
@ -380,7 +380,7 @@ p6_cleanup(int cpu)
PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu);
if ((pcs = pmc_pcpu[cpu]) != NULL)
FREE(pcs, M_PMC);
free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL;
return 0;

View File

@ -293,7 +293,7 @@ pmc_intel_initialize(void)
return NULL;
}
MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep),
pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype;
@ -346,7 +346,7 @@ pmc_intel_initialize(void)
}
if (error) {
FREE(pmc_mdep, M_PMC);
free(pmc_mdep, M_PMC);
pmc_mdep = NULL;
}

View File

@ -5070,8 +5070,8 @@ ng_rcvmsg(node_p node, struct ng_mesg *msg,
if (rptr != NULL)
*rptr = resp;
else if (resp != NULL)
FREE(resp, M_NETGRAPH);
FREE(msg, M_NETGRAPH);
free(resp, M_NETGRAPH);
free(msg, M_NETGRAPH);
# endif
return error;

View File

@ -3177,8 +3177,7 @@ ray_com_malloc(ray_comqfn_t function, int flags, char *mesg)
{
struct ray_comq_entry *com;
MALLOC(com, struct ray_comq_entry *,
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

@ -249,7 +249,7 @@ static int mib_info[RAY_MIB_MAX+1][3] = RAY_MIB_INFO;
#define RAY_COM_FREE(com, ncom) do { \
int i; \
for (i = 0; i < ncom; i++) \
FREE(com[i], M_RAYCOM); \
free(com[i], M_RAYCOM); \
} while (0)
/*

View File

@ -305,8 +305,7 @@ sr_attach(device_t device)
int unit; /* index: channel w/in card */
hc = (struct sr_hardc *)device_get_softc(device);
MALLOC(sc, struct sr_softc *,
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;
@ -478,7 +477,7 @@ sr_detach(device_t device)
* deallocate any system resources we may have
* allocated on behalf of this driver.
*/
FREE(hc->sc, M_DEVBUF);
free(hc->sc, M_DEVBUF);
hc->sc = NULL;
hc->mem_start = NULL;
return (sr_deallocate_resources(device));

View File

@ -411,10 +411,10 @@ udbp_attach(device_t self)
bad:
#if 0 /* probably done in udbp_detach() */
if (sc->sc_bulkout_buffer) {
FREE(sc->sc_bulkout_buffer, M_USBDEV);
free(sc->sc_bulkout_buffer, M_USBDEV);
}
if (sc->sc_bulkin_buffer) {
FREE(sc->sc_bulkin_buffer, M_USBDEV);
free(sc->sc_bulkin_buffer, M_USBDEV);
}
if (sc->sc_bulkout_xfer) {
usbd_free_xfer(sc->sc_bulkout_xfer);

View File

@ -111,7 +111,7 @@ cd9660_reclaim(ap)
*/
if (ip->i_mnt->im_devvp)
vrele(ip->i_mnt->im_devvp);
FREE(vp->v_data, M_ISOFSNODE);
free(vp->v_data, M_ISOFSNODE);
vp->v_data = NULL;
return (0);
}

View File

@ -676,7 +676,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
*vpp = NULLVP;
return (error);
}
MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE,
ip = malloc(sizeof(struct iso_node), M_ISOFSNODE,
M_WAITOK | M_ZERO);
vp->v_data = ip;
ip->i_vnode = vp;

View File

@ -207,7 +207,7 @@ cd9660_getattr(ap)
struct uio auio;
char *cp;
MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK);
cp = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
aiov.iov_base = cp;
aiov.iov_len = MAXPATHLEN;
auio.uio_iov = &aiov;
@ -222,7 +222,7 @@ cd9660_getattr(ap)
rdlnk.a_cred = ap->a_cred;
if (cd9660_readlink(&rdlnk) == 0)
vap->va_size = MAXPATHLEN - auio.uio_resid;
FREE(cp, M_TEMP);
free(cp, M_TEMP);
}
vap->va_flags = 0;
vap->va_gen = 1;
@ -470,7 +470,7 @@ cd9660_readdir(ap)
imp = dp->i_mnt;
bmask = imp->im_bmask;
MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK);
idp = malloc(sizeof(*idp), M_TEMP, M_WAITOK);
idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
/*
* XXX
@ -486,7 +486,7 @@ cd9660_readdir(ap)
* Guess the number of cookies needed.
*/
ncookies = uio->uio_resid / 16;
MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK);
idp->cookies = cookies;
idp->ncookies = ncookies;
@ -497,7 +497,7 @@ cd9660_readdir(ap)
if ((entryoffsetinblock = idp->curroff & bmask) &&
(error = cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) {
FREE(idp, M_TEMP);
free(idp, M_TEMP);
return (error);
}
endsearch = dp->i_size;
@ -620,7 +620,7 @@ cd9660_readdir(ap)
uio->uio_offset = idp->uio_off;
*ap->a_eofflag = idp->eofflag;
FREE(idp, M_TEMP);
free(idp, M_TEMP);
return (error);
}

View File

@ -85,7 +85,7 @@ fdesc_mount(struct mount *mp, struct thread *td)
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
return (EOPNOTSUPP);
MALLOC(fmp, struct fdescmount *, sizeof(struct fdescmount),
fmp = malloc(sizeof(struct fdescmount),
M_FDESCMNT, M_WAITOK); /* XXX */
/*

View File

@ -186,11 +186,11 @@ fdesc_allocvp(ftype, fd_fd, ix, mp, vpp, td)
}
mtx_unlock(&fdesc_hashmtx);
MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK);
fd = malloc(sizeof(struct fdescnode), M_TEMP, M_WAITOK);
error = getnewvnode("fdescfs", mp, &fdesc_vnodeops, &vp);
if (error) {
FREE(fd, M_TEMP);
free(fd, M_TEMP);
return (error);
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@ -616,7 +616,7 @@ fdesc_reclaim(ap)
vp = ap->a_vp;
fd = VTOFDESC(vp);
fdesc_remove_entry(fd);
FREE(vp->v_data, M_TEMP);
free(vp->v_data, M_TEMP);
vp->v_data = NULL;
return (0);
}

View File

@ -154,7 +154,7 @@ fifo_cleanup(struct vnode *vp)
vp->v_fifoinfo = NULL;
(void)soclose(fip->fi_readsock);
(void)soclose(fip->fi_writesock);
FREE(fip, M_VNODE);
free(fip, M_VNODE);
}
}
@ -185,7 +185,7 @@ fifo_open(ap)
if (fp == NULL)
return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK);
error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, cred, td);
if (error)
goto fail1;

View File

@ -85,8 +85,8 @@ hpfs_bmdeinit(
}
}
FREE(hpmp->hpm_bitmap,M_HPFSMNT);
FREE(hpmp->hpm_bmind,M_HPFSMNT);
free(hpmp->hpm_bitmap,M_HPFSMNT);
free(hpmp->hpm_bmind,M_HPFSMNT);
dprintf(("\n"));
}
@ -109,18 +109,18 @@ hpfs_bminit(
dprintf(("0x%lx data bands, ", hpmp->hpm_dbnum));
MALLOC(hpmp->hpm_bmind, lsn_t *, hpmp->hpm_dbnum * sizeof(lsn_t),
hpmp->hpm_bmind = malloc(hpmp->hpm_dbnum * sizeof(lsn_t),
M_HPFSMNT, M_WAITOK);
MALLOC(hpmp->hpm_bitmap, u_int8_t *, hpmp->hpm_dbnum * BMSIZE,
hpmp->hpm_bitmap = malloc(hpmp->hpm_dbnum * BMSIZE,
M_HPFSMNT, M_WAITOK);
error = bread(hpmp->hpm_devvp, hpmp->hpm_su.su_bitmap.lsn1,
((hpmp->hpm_dbnum + 0x7F) & ~(0x7F)) << 2, NOCRED, &bp);
if (error) {
brelse(bp);
FREE(hpmp->hpm_bitmap, M_HPFSMNT);
FREE(hpmp->hpm_bmind, M_HPFSMNT);
free(hpmp->hpm_bitmap, M_HPFSMNT);
free(hpmp->hpm_bmind, M_HPFSMNT);
dprintf((" error %d\n", error));
return (error);
}
@ -138,8 +138,8 @@ hpfs_bminit(
BMSIZE, NOCRED, &bp);
if (error) {
brelse(bp);
FREE(hpmp->hpm_bitmap, M_HPFSMNT);
FREE(hpmp->hpm_bmind, M_HPFSMNT);
free(hpmp->hpm_bitmap, M_HPFSMNT);
free(hpmp->hpm_bmind, M_HPFSMNT);
dprintf((" error %d\n", error));
return (error);
}
@ -278,8 +278,7 @@ hpfs_cpinit (
cpicnt = hpmp->hpm_sp.sp_cpinum;
MALLOC(hpmp->hpm_cpdblk, struct cpdblk *,
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;
@ -317,7 +316,7 @@ hpfs_cpdeinit (
struct hpfsmount *hpmp)
{
dprintf(("hpmp_cpdeinit: "));
FREE(hpmp->hpm_cpdblk,M_HPFSMNT);
free(hpmp->hpm_cpdblk,M_HPFSMNT);
return (0);
}

View File

@ -371,7 +371,7 @@ hpfs_unmount(
MNT_ILOCK(mp);
mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp);
FREE(hpmp, M_HPFSMNT);
free(hpmp, M_HPFSMNT);
return (0);
}
@ -476,13 +476,13 @@ hpfs_vget(
* at that time is little, and anyway - we'll
* check for it).
*/
MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode),
hp = malloc(sizeof(struct hpfsnode),
M_HPFSNO, M_WAITOK);
error = getnewvnode("hpfs", mp, &hpfs_vnodeops, &vp);
if (error) {
printf("hpfs_vget: can't get new vnode\n");
FREE(hp, M_HPFSNO);
free(hp, M_HPFSNO);
return (error);
}

View File

@ -611,7 +611,7 @@ hpfs_reclaim(ap)
vp->v_data = NULL;
FREE(hp, M_HPFSNO);
free(hp, M_HPFSNO);
return (0);
}
@ -1003,7 +1003,7 @@ hpfs_readdir(ap)
dpStart = (struct dirent *)
((caddr_t)uio->uio_iov->iov_base -
(uio->uio_offset - off));
MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK);
for (dp = dpStart, cookiep = cookies, i=0;
i < ncookies;

View File

@ -148,7 +148,7 @@ deget(pmp, dirclust, diroffset, depp)
* might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block.
*/
MALLOC(ldep, struct denode *, sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK);
ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK);
/*
* Directory entry was not in cache, have to create a vnode and
@ -158,7 +158,7 @@ deget(pmp, dirclust, diroffset, depp)
error = getnewvnode("msdosfs", mntp, &msdosfs_vnodeops, &nvp);
if (error) {
*depp = NULL;
FREE(ldep, M_MSDOSFSNODE);
free(ldep, M_MSDOSFSNODE);
return error;
}
bzero((caddr_t)ldep, sizeof *ldep);
@ -173,7 +173,7 @@ deget(pmp, dirclust, diroffset, depp)
lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
error = insmntque(nvp, mntp);
if (error != 0) {
FREE(ldep, M_MSDOSFSNODE);
free(ldep, M_MSDOSFSNODE);
*depp = NULL;
return (error);
}
@ -567,7 +567,7 @@ msdosfs_reclaim(ap)
#if 0 /* XXX */
dep->de_flag = 0;
#endif
FREE(dep, M_MSDOSFSNODE);
free(dep, M_MSDOSFSNODE);
vp->v_data = NULL;
return (0);

View File

@ -1561,7 +1561,7 @@ msdosfs_readdir(ap)
if (ap->a_ncookies) {
ncookies = uio->uio_resid / 16;
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP,
cookies = malloc(ncookies * sizeof(u_long), M_TEMP,
M_WAITOK);
*ap->a_cookies = cookies;
*ap->a_ncookies = ncookies;

View File

@ -190,7 +190,7 @@ ntfs_ntvattrget(
}
/* Scan $ATTRIBUTE_LIST for requested attribute */
len = lvap->va_datalen;
MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK);
alpool = malloc(len, M_TEMP, M_WAITOK);
error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len,
NULL);
if (error)
@ -246,7 +246,7 @@ ntfs_ntvattrget(
"ino: %d, type: 0x%x, name: %.*s, vcn: %d\n", \
ip->i_number, type, (int) namelen, name, (u_int32_t) vcn));
out:
FREE(alpool, M_TEMP);
free(alpool, M_TEMP);
return (error);
}
@ -268,7 +268,7 @@ ntfs_loadntnode(
dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number));
MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec),
mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec),
M_TEMP, M_WAITOK);
if (ip->i_number < NTFS_SYSNODESNUM) {
@ -341,7 +341,7 @@ ntfs_loadntnode(
ip->i_flag |= IN_LOADED;
out:
FREE(mfrp, M_TEMP);
free(mfrp, M_TEMP);
return (error);
}
@ -391,7 +391,7 @@ ntfs_ntlookup(
}
} while (lockmgr(&ntfs_hashlock, LK_EXCLUSIVE | LK_SLEEPFAIL, NULL));
MALLOC(ip, struct ntnode *, sizeof(struct ntnode), M_NTFSNTNODE,
ip = malloc(sizeof(struct ntnode), M_NTFSNTNODE,
M_WAITOK | M_ZERO);
ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip));
@ -466,7 +466,7 @@ ntfs_ntput(ip)
mtx_destroy(&ip->i_interlock);
lockdestroy(&ip->i_lock);
vrele(ip->i_devvp);
FREE(ip, M_NTFSNTNODE);
free(ip, M_NTFSNTNODE);
}
/*
@ -513,14 +513,14 @@ ntfs_freentvattr(vap)
{
if (vap->va_flag & NTFS_AF_INRUN) {
if (vap->va_vruncn)
FREE(vap->va_vruncn, M_NTFSRUN);
free(vap->va_vruncn, M_NTFSRUN);
if (vap->va_vruncl)
FREE(vap->va_vruncl, M_NTFSRUN);
free(vap->va_vruncl, M_NTFSRUN);
} else {
if (vap->va_datap)
FREE(vap->va_datap, M_NTFSRDATA);
free(vap->va_datap, M_NTFSRDATA);
}
FREE(vap, M_NTFSNTVATTR);
free(vap, M_NTFSNTVATTR);
}
/*
@ -539,7 +539,7 @@ ntfs_attrtontvattr(
error = 0;
*rvapp = NULL;
MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr),
vap = malloc(sizeof(struct ntvattr),
M_NTFSNTVATTR, M_WAITOK | M_ZERO);
vap->va_ip = NULL;
vap->va_flag = rap->a_hdr.a_flag;
@ -576,7 +576,7 @@ ntfs_attrtontvattr(
vap->va_allocated = rap->a_r.a_datalen;
vap->va_vcnstart = 0;
vap->va_vcnend = ntfs_btocn(vap->va_allocated);
MALLOC(vap->va_datap, caddr_t, vap->va_datalen,
vap->va_datap = malloc(vap->va_datalen,
M_NTFSRDATA, M_WAITOK);
memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff,
rap->a_r.a_datalen);
@ -584,7 +584,7 @@ ntfs_attrtontvattr(
ddprintf((", len: %d", vap->va_datalen));
if (error)
FREE(vap, M_NTFSNTVATTR);
free(vap, M_NTFSNTVATTR);
else
*rvapp = vap;
@ -618,8 +618,8 @@ ntfs_runtovrun(
off += (run[off] & 0xF) + ((run[off] >> 4) & 0xF) + 1;
cnt++;
}
MALLOC(cn, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
MALLOC(cl, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
cn = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
cl = malloc(cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK);
off = 0;
cnt = 0;
@ -769,14 +769,14 @@ ntfs_fget(
if (*fpp)
return (0);
MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE,
fp = malloc(sizeof(struct fnode), M_NTFSFNODE,
M_WAITOK | M_ZERO);
dprintf(("ntfs_fget: allocating fnode: %p\n",fp));
fp->f_ip = ip;
if (attrname) {
fp->f_flag |= FN_AATTRNAME;
MALLOC(fp->f_attrname, char *, strlen(attrname)+1, M_TEMP, M_WAITOK);
fp->f_attrname = malloc(strlen(attrname)+1, M_TEMP, M_WAITOK);
strcpy(fp->f_attrname, attrname);
} else
fp->f_attrname = NULL;
@ -807,10 +807,10 @@ ntfs_frele(
dprintf(("ntfs_frele: deallocating fnode\n"));
LIST_REMOVE(fp,f_fnlist);
if (fp->f_flag & FN_AATTRNAME)
FREE(fp->f_attrname, M_TEMP);
free(fp->f_attrname, M_TEMP);
if (fp->f_dirblbuf)
FREE(fp->f_dirblbuf, M_NTFSDIR);
FREE(fp, M_NTFSFNODE);
free(fp->f_dirblbuf, M_NTFSDIR);
free(fp, M_NTFSFNODE);
ntfs_ntrele(ip);
}
@ -861,7 +861,7 @@ ntfs_ntlookupattr(
out:
if (namelen) {
MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK);
(*attrname) = malloc(namelen, M_TEMP, M_WAITOK);
memcpy((*attrname), name, namelen);
(*attrname)[namelen] = '\0';
}
@ -926,7 +926,7 @@ ntfs_ntlookupfile(
dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %jd\n", blsize, rdsize));
MALLOC(rdbuf, caddr_t, blsize, M_TEMP, M_WAITOK);
rdbuf = malloc(blsize, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30",
0, rdsize, rdbuf, NULL);
@ -991,7 +991,7 @@ ntfs_ntlookupfile(
/* free the buffer returned by ntfs_ntlookupattr() */
if (attrname) {
FREE(attrname, M_TEMP);
free(attrname, M_TEMP);
attrname = NULL;
}
@ -1069,10 +1069,10 @@ ntfs_ntlookupfile(
dprintf(("finish\n"));
fail:
if (attrname) FREE(attrname, M_TEMP);
if (attrname) free(attrname, M_TEMP);
ntfs_ntvattrrele(vap);
ntfs_ntput(ip);
FREE(rdbuf, M_TEMP);
free(rdbuf, M_TEMP);
return (error);
}
@ -1143,8 +1143,7 @@ ntfs_ntreaddir(
if (fp->f_dirblbuf == NULL) {
fp->f_dirblsz = vap->va_a_iroot->ir_size;
MALLOC(fp->f_dirblbuf, caddr_t,
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;
@ -1159,7 +1158,7 @@ ntfs_ntreaddir(
error = ENOTDIR;
goto fail;
}
MALLOC(bmp, u_int8_t *, bmvap->va_datalen, M_TEMP, M_WAITOK);
bmp = malloc(bmvap->va_datalen, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0,
bmvap->va_datalen, bmp, NULL);
if (error)
@ -1265,7 +1264,7 @@ ntfs_ntreaddir(
if (iavap)
ntfs_ntvattrrele(iavap);
if (bmp)
FREE(bmp, M_TEMP);
free(bmp, M_TEMP);
ntfs_ntput(ip);
return (error);
}
@ -1756,9 +1755,9 @@ ntfs_readattr(
ddprintf(("ntfs_ntreadattr: compression: %d\n",
vap->va_compressalg));
MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL),
cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
M_NTFSDECOMP, M_WAITOK);
MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL),
uup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
M_NTFSDECOMP, M_WAITOK);
cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1));
@ -1803,8 +1802,8 @@ ntfs_readattr(
cn += NTFS_COMPUNIT_CL;
}
FREE(uup, M_NTFSDECOMP);
FREE(cup, M_NTFSDECOMP);
free(uup, M_NTFSDECOMP);
free(cup, M_NTFSDECOMP);
} else
error = ntfs_readattr_plain(ntmp, ip, attrnum, attrname,
roff, rsize, rdata, &init, uio);
@ -1991,7 +1990,7 @@ ntfs_toupper_use(mp, ntmp)
* XXX for now, just the first 256 entries are used anyway,
* so don't bother reading more
*/
MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar),
ntfs_toupper_tab = malloc(65536 * sizeof(wchar),
M_NTFSRDATA, M_WAITOK);
if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp)))
@ -2018,7 +2017,7 @@ ntfs_toupper_unuse()
ntfs_toupper_usecount--;
if (ntfs_toupper_usecount == 0) {
FREE(ntfs_toupper_tab, M_NTFSRDATA);
free(ntfs_toupper_tab, M_NTFSRDATA);
ntfs_toupper_tab = NULL;
}
#ifdef DIAGNOSTIC
@ -2047,14 +2046,14 @@ ntfs_u28_init(
return (0);
}
MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO);
u28 = malloc(256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO);
for (i=0; i<256; i++) {
h = (u2w[i] >> 8) & 0xFF;
l = (u2w[i]) &0xFF;
if (u28[h] == NULL) {
MALLOC(u28[h], char *, 256 * sizeof(char), M_TEMP, M_WAITOK);
u28[h] = malloc(256 * sizeof(char), M_TEMP, M_WAITOK);
for (j=0; j<256; j++)
u28[h][j] = '_';
}
@ -2084,9 +2083,9 @@ ntfs_u28_uninit(struct ntfsmount *ntmp)
for (i=0; i<256; i++)
if (u28[i] != NULL)
FREE(u28[i], M_TEMP);
free(u28[i], M_TEMP);
FREE(u28, M_TEMP);
free(u28, M_TEMP);
return (0);
}
@ -2105,7 +2104,7 @@ ntfs_82u_init(
return (0);
}
MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, M_WAITOK);
_82u = malloc(256 * sizeof(wchar), M_TEMP, M_WAITOK);
for (i=0; i<256; i++)
_82u[i] = i;
@ -2126,7 +2125,7 @@ ntfs_82u_uninit(struct ntfsmount *ntmp)
return (0);
}
FREE(ntmp->ntm_82u, M_TEMP);
free(ntmp->ntm_82u, M_TEMP);
return (0);
}

View File

@ -416,8 +416,7 @@ ntfs_mountfs(devvp, mp, td)
}
/* Alloc memory for attribute definitions */
MALLOC(ntmp->ntm_ad, struct ntvattrdef *,
num * sizeof(struct ntvattrdef),
ntmp->ntm_ad = malloc( num * sizeof(struct ntvattrdef),
M_NTFSMNT, M_WAITOK);
ntmp->ntm_adnum = num;
@ -526,8 +525,8 @@ ntfs_unmount(
MNT_ILOCK(mp);
mp->mnt_flag &= ~MNT_LOCAL;
MNT_IUNLOCK(mp);
FREE(ntmp->ntm_ad, M_NTFSMNT);
FREE(ntmp, M_NTFSMNT);
free(ntmp->ntm_ad, M_NTFSMNT);
free(ntmp, M_NTFSMNT);
return (error);
}
@ -568,7 +567,7 @@ ntfs_calccfree(
bmsize = VTOF(vp)->f_size;
MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK);
tmp = malloc(bmsize, M_TEMP, M_WAITOK);
error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL,
0, bmsize, tmp, NULL);
@ -581,7 +580,7 @@ ntfs_calccfree(
*cfreep = cfree;
out:
FREE(tmp, M_TEMP);
free(tmp, M_TEMP);
return(error);
}

View File

@ -595,7 +595,7 @@ ntfs_readdir(ap)
dpStart = (struct dirent *)
((caddr_t)uio->uio_iov->iov_base -
(uio->uio_offset - off));
MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
cookies = malloc(ncookies * sizeof(u_long),
M_TEMP, M_WAITOK);
for (dp = dpStart, cookiep = cookies, i=0;
i < ncookies;

View File

@ -173,7 +173,7 @@ null_insmntque_dtr(struct vnode *vp, void *xp)
{
vp->v_data = NULL;
vp->v_vnlock = &vp->v_lock;
FREE(xp, M_NULLFSNODE);
free(xp, M_NULLFSNODE);
vp->v_op = &dead_vnodeops;
(void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vgone(vp);
@ -218,12 +218,12 @@ null_nodeget(mp, lowervp, vpp)
* might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block.
*/
MALLOC(xp, struct null_node *, sizeof(struct null_node),
xp = malloc(sizeof(struct null_node),
M_NULLFSNODE, M_WAITOK);
error = getnewvnode("null", mp, &null_vnodeops, &vp);
if (error) {
FREE(xp, M_NULLFSNODE);
free(xp, M_NULLFSNODE);
return (error);
}

View File

@ -677,7 +677,7 @@ null_reclaim(struct vop_reclaim_args *ap)
vput(lowervp);
} else
panic("null_reclaim: reclaiming a node with no lowervp");
FREE(xp, M_NULLFSNODE);
free(xp, M_NULLFSNODE);
return (0);
}

View File

@ -169,16 +169,16 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
* might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block.
*/
MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO);
np = malloc(sizeof *np, M_NWNODE, M_WAITOK | M_ZERO);
error = getnewvnode("nwfs", mp, &nwfs_vnodeops, &vp);
if (error) {
*vpp = NULL;
FREE(np, M_NWNODE);
free(np, M_NWNODE);
return (error);
}
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) {
FREE(np, M_NWNODE);
free(np, M_NWNODE);
*vpp = NULL;
return (error);
}
@ -201,7 +201,7 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
vp->v_data = NULL;
np->n_vnode = NULL;
vrele(vp);
FREE(np, M_NWNODE);
free(np, M_NWNODE);
goto rescan;
}
*vpp = vp;
@ -283,7 +283,7 @@ nwfs_reclaim(ap)
nmp->n_root = NULL;
}
vp->v_data = NULL;
FREE(np, M_NWNODE);
free(np, M_NWNODE);
if (dvp) {
vrele(dvp);
}

View File

@ -114,7 +114,7 @@ nwfs_initnls(struct nwmount *nmp) {
nmp->m.nls.u2n = ncp_defnls.u2n;
return 0;
}
MALLOC(pe, char *, 256 * 4, M_NWFSDATA, M_WAITOK);
pe = malloc(256 * 4, M_NWFSDATA, M_WAITOK);
pc = pe;
do {
COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower);
@ -191,7 +191,7 @@ static int nwfs_mount(struct mount *mp, struct thread *td)
ncp_conn_unlock(conn, td); /* we keep the ref */
mp->mnt_stat.f_iosize = conn->buffer_size;
/* We must malloc our own mount info */
MALLOC(nmp,struct nwmount *,sizeof(struct nwmount),M_NWFSDATA,
nmp = malloc(sizeof(struct nwmount),M_NWFSDATA,
M_WAITOK | M_USE_RESERVE | M_ZERO);
if (nmp == NULL) {
nwfs_printf("could not alloc nwmount\n");

View File

@ -122,24 +122,24 @@ portal_mount(struct mount *mp, struct thread *td)
return (ESOCKTNOSUPPORT);
}
MALLOC(pn, struct portalnode *, sizeof(struct portalnode),
pn = malloc(sizeof(struct portalnode),
M_TEMP, M_WAITOK);
MALLOC(fmp, struct portalmount *, sizeof(struct portalmount),
fmp = malloc(sizeof(struct portalmount),
M_PORTALFSMNT, M_WAITOK); /* XXX */
error = getnewvnode("portal", mp, &portal_vnodeops, &rvp); /* XXX */
if (error) {
FREE(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP);
free(fmp, M_PORTALFSMNT);
free(pn, M_TEMP);
fdrop(fp, td);
return (error);
}
error = insmntque(rvp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) {
FREE(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP);
free(fmp, M_PORTALFSMNT);
free(pn, M_TEMP);
fdrop(fp, td);
return (error);
}

View File

@ -127,12 +127,12 @@ portal_lookup(ap)
* might cause a bogus v_data pointer to get dereferenced
* elsewhere if MALLOC should block.
*/
MALLOC(pt, struct portalnode *, sizeof(struct portalnode),
pt = malloc(sizeof(struct portalnode),
M_TEMP, M_WAITOK);
error = getnewvnode("portal", dvp->v_mount, &portal_vnodeops, &fvp);
if (error) {
FREE(pt, M_TEMP);
free(pt, M_TEMP);
goto bad;
}
fvp->v_type = VREG;
@ -542,7 +542,7 @@ portal_reclaim(ap)
free((caddr_t) pt->pt_arg, M_TEMP);
pt->pt_arg = 0;
}
FREE(ap->a_vp->v_data, M_TEMP);
free(ap->a_vp->v_data, M_TEMP);
ap->a_vp->v_data = 0;
return (0);

View File

@ -71,7 +71,7 @@ pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type)
KASSERT(strlen(name) < PFS_NAMELEN,
("%s(): node name is too long", __func__));
MALLOC(pn, struct pfs_node *, sizeof *pn,
pn = malloc(sizeof *pn,
M_PFSNODES, M_WAITOK|M_ZERO);
mtx_init(&pn->pn_mutex, "pfs_node", NULL, MTX_DEF | MTX_DUPOK);
strlcpy(pn->pn_name, name, sizeof pn->pn_name);
@ -290,7 +290,7 @@ pfs_destroy(struct pfs_node *pn)
/* destroy the node */
pfs_fileno_free(pn);
mtx_destroy(&pn->pn_mutex);
FREE(pn, M_PFSNODES);
free(pn, M_PFSNODES);
return (0);
}

View File

@ -149,7 +149,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
++pfs_vncache_misses;
/* nope, get a new one */
MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK);
pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK);
mtx_lock(&pfs_vncache_mutex);
if (++pfs_vncache_entries > pfs_vncache_maxentries)
pfs_vncache_maxentries = pfs_vncache_entries;
@ -159,7 +159,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
mtx_lock(&pfs_vncache_mutex);
--pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE);
free(pvd, M_PFSVNCACHE);
return (error);
}
pvd->pvd_pn = pn;
@ -203,7 +203,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
mtx_lock(&pfs_vncache_mutex);
--pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE);
free(pvd, M_PFSVNCACHE);
*vpp = NULLVP;
return (error);
}
@ -237,7 +237,7 @@ pfs_vncache_free(struct vnode *vp)
--pfs_vncache_entries;
mtx_unlock(&pfs_vncache_mutex);
FREE(pvd, M_PFSVNCACHE);
free(pvd, M_PFSVNCACHE);
vp->v_data = NULL;
return (0);
}

View File

@ -229,15 +229,15 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
if (fap == NULL)
return ENOENT;
MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK);
np = malloc(sizeof *np, M_SMBNODE, M_WAITOK);
error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp);
if (error) {
FREE(np, M_SMBNODE);
free(np, M_SMBNODE);
return error;
}
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) {
FREE(np, M_SMBNODE);
free(np, M_SMBNODE);
return (error);
}
vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG;
@ -269,7 +269,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
continue;
vput(vp);
/* smb_name_free(np->n_name);
FREE(np, M_SMBNODE);*/
free(np, M_SMBNODE);*/
goto loop;
}
LIST_INSERT_HEAD(nhpp, np, n_hash);
@ -335,7 +335,7 @@ smbfs_reclaim(ap)
smbfs_hash_unlock(smp);
if (np->n_name)
smbfs_name_free(np->n_name);
FREE(np, M_SMBNODE);
free(np, M_SMBNODE);
if (dvp != NULL) {
vrele(dvp);
/*

View File

@ -179,7 +179,7 @@ smbfs_mount(struct mount *mp, struct thread *td)
#ifdef SMBFS_USEZONE
smp = zalloc(smbfsmount_zone);
#else
MALLOC(smp, struct smbmount*, sizeof(*smp), M_SMBFSDATA,
smp = malloc(sizeof(*smp), M_SMBFSDATA,
M_WAITOK|M_USE_RESERVE);
#endif
if (smp == NULL) {

View File

@ -331,7 +331,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) {
bo = &devvp->v_bufobj;
/* XXX: should be M_WAITOK */
MALLOC(udfmp, struct udf_mnt *, sizeof(struct udf_mnt), M_UDFMOUNT,
udfmp = malloc(sizeof(struct udf_mnt), M_UDFMOUNT,
M_NOWAIT | M_ZERO);
if (udfmp == NULL) {
printf("Cannot allocate UDF mount struct\n");
@ -488,7 +488,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) {
bail:
if (udfmp != NULL)
FREE(udfmp, M_UDFMOUNT);
free(udfmp, M_UDFMOUNT);
if (bp != NULL)
brelse(bp);
DROP_GIANT();
@ -530,9 +530,9 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td)
vrele(udfmp->im_devvp);
if (udfmp->s_table != NULL)
FREE(udfmp->s_table, M_UDFMOUNT);
free(udfmp->s_table, M_UDFMOUNT);
FREE(udfmp, M_UDFMOUNT);
free(udfmp, M_UDFMOUNT);
mp->mnt_data = NULL;
MNT_ILOCK(mp);
@ -647,7 +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);
MALLOC(unode->fentry, struct file_entry *, size, M_UDFFENTRY,
unode->fentry = malloc(size, M_UDFFENTRY,
M_NOWAIT | M_ZERO);
if (unode->fentry == NULL) {
printf("Cannot allocate file entry block\n");
@ -757,8 +757,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
pms = (struct part_map_spare *)pmap;
pmap += UDF_PMAP_TYPE2_SIZE;
MALLOC(udfmp->s_table, struct udf_sparing_table *,
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);
@ -776,7 +775,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
brelse(bp);
printf("Failed to read Sparing Table at sector %d\n",
le32toh(pms->st_loc[0]));
FREE(udfmp->s_table, M_UDFMOUNT);
free(udfmp->s_table, M_UDFMOUNT);
return (error);
}
bcopy(bp->b_data, udfmp->s_table, le32toh(pms->st_size));
@ -784,7 +783,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
if (udf_checktag(&udfmp->s_table->tag, 0)) {
printf("Invalid sparing table found\n");
FREE(udfmp->s_table, M_UDFMOUNT);
free(udfmp->s_table, M_UDFMOUNT);
return (EINVAL);
}

View File

@ -574,7 +574,7 @@ udf_getfid(struct udf_dirstream *ds)
*/
if (ds->fid_fragment && ds->buf != NULL) {
ds->fid_fragment = 0;
FREE(ds->buf, M_UDFFID);
free(ds->buf, M_UDFFID);
}
fid = (struct fileid_desc*)&ds->data[ds->off];
@ -599,7 +599,7 @@ udf_getfid(struct udf_dirstream *ds)
* File ID descriptors can only be at most one
* logical sector in size.
*/
MALLOC(ds->buf, uint8_t*, ds->udfmp->bsize, M_UDFFID,
ds->buf = malloc(ds->udfmp->bsize, M_UDFFID,
M_WAITOK | M_ZERO);
bcopy(fid, ds->buf, frag_size);
@ -668,7 +668,7 @@ udf_closedir(struct udf_dirstream *ds)
brelse(ds->bp);
if (ds->fid_fragment && ds->buf != NULL)
FREE(ds->buf, M_UDFFID);
free(ds->buf, M_UDFFID);
uma_zfree(udf_zone_ds, ds);
}
@ -701,7 +701,7 @@ udf_readdir(struct vop_readdir_args *a)
* it left off.
*/
ncookies = uio->uio_resid / 8;
MALLOC(cookies, u_long *, sizeof(u_long) * ncookies,
cookies = malloc(sizeof(u_long) * ncookies,
M_TEMP, M_WAITOK);
if (cookies == NULL)
return (ENOMEM);
@ -787,7 +787,7 @@ udf_readdir(struct vop_readdir_args *a)
if (a->a_ncookies != NULL) {
if (error)
FREE(cookies, M_TEMP);
free(cookies, M_TEMP);
else {
*a->a_ncookies = uiodir.acookies;
*a->a_cookies = cookies;
@ -1028,7 +1028,7 @@ udf_reclaim(struct vop_reclaim_args *a)
vfs_hash_remove(vp);
if (unode->fentry != NULL)
FREE(unode->fentry, M_UDFFENTRY);
free(unode->fentry, M_UDFFENTRY);
uma_zfree(udf_zone_node, unode);
vp->v_data = NULL;
}

View File

@ -257,17 +257,17 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
* might cause a bogus v_data pointer to get dereferenced elsewhere
* if MALLOC should block.
*/
MALLOC(unp, struct unionfs_node *, sizeof(struct unionfs_node),
unp = malloc(sizeof(struct unionfs_node),
M_UNIONFSNODE, M_WAITOK | M_ZERO);
error = getnewvnode("unionfs", mp, &unionfs_vnodeops, &vp);
if (error != 0) {
FREE(unp, M_UNIONFSNODE);
free(unp, M_UNIONFSNODE);
return (error);
}
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
if (error != 0) {
FREE(unp, M_UNIONFSNODE);
free(unp, M_UNIONFSNODE);
return (error);
}
if (dvp != NULLVP)
@ -415,7 +415,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td)
LIST_REMOVE(unsp, uns_list);
free(unsp, M_TEMP);
}
FREE(unp, M_UNIONFSNODE);
free(unp, M_UNIONFSNODE);
}
/*
@ -440,8 +440,7 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
}
/* create a new unionfs node status */
MALLOC(unsp, struct unionfs_node_status *,
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

@ -409,7 +409,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
}
bap = (int32_t *)bp->b_data;
MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK);
copy = malloc(fs->s_blocksize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize);
bzero((caddr_t)&bap[last + 1],
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t));
@ -451,7 +451,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
blocksreleased += blkcount;
}
}
FREE(copy, M_TEMP);
free(copy, M_TEMP);
*countp = blocksreleased;
return (allerror);
}
@ -521,7 +521,7 @@ ext2_reclaim(ap)
ext2_update(vp, 0);
}
vfs_hash_remove(vp);
FREE(vp->v_data, M_EXT2NODE);
free(vp->v_data, M_EXT2NODE);
vp->v_data = 0;
vnode_destroy_vobject(vp);
return (0);

View File

@ -177,7 +177,7 @@ ext2_readdir(ap)
auio.uio_resid = count;
auio.uio_segflg = UIO_SYSSPACE;
aiov.iov_len = count;
MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK);
dirbuf = malloc(count, M_TEMP, M_WAITOK);
aiov.iov_base = dirbuf;
error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred);
if (error == 0) {
@ -237,7 +237,7 @@ ext2_readdir(ap)
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
panic("ext2_readdir: unexpected uio from NFS server");
MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP,
cookies = malloc(ncookies * sizeof(u_long), M_TEMP,
M_WAITOK);
off = startoffset;
for (dp = (struct ext2_dir_entry_2 *)dirbuf,
@ -251,7 +251,7 @@ ext2_readdir(ap)
*ap->a_cookies = cookies;
}
}
FREE(dirbuf, M_TEMP);
free(dirbuf, M_TEMP);
if (ap->a_eofflag)
*ap->a_eofflag = VTOI(ap->a_vp)->i_size <= uio->uio_offset;
return (error);

View File

@ -964,7 +964,7 @@ ext2_vget(mp, ino, flags, vpp)
dev = ump->um_dev;
/*
* If this MALLOC() is performed after the getnewvnode()
* If this malloc() is performed after the getnewvnode()
* it might block, leaving a vnode with a NULL v_data to be
* found by ext2_sync() if a sync happens to fire right then,
* which will cause a panic because ext2_sync() blindly

View File

@ -157,7 +157,7 @@ reiserfs_reclaim(struct vop_reclaim_args *ap)
vfs_hash_remove(vp);
reiserfs_log(LOG_DEBUG, "free private data\n");
FREE(vp->v_data, M_REISERFSNODE);
free(vp->v_data, M_REISERFSNODE);
vp->v_data = NULL;
vnode_destroy_vobject(vp);
@ -764,7 +764,7 @@ reiserfs_iget(
dev = rmp->rm_dev;
/*
* If this MALLOC() is performed after the getnewvnode() it might
* If this malloc() is performed after the getnewvnode() it might
* block, leaving a vnode with a NULL v_data to be found by
* reiserfs_sync() if a sync happens to fire right then, which
* will cause a panic because reiserfs_sync() blindly dereferences

View File

@ -929,7 +929,7 @@ get_root_node(struct reiserfs_mount *rmp, struct reiserfs_node **root)
/* Allocate the node structure */
reiserfs_log(LOG_DEBUG, "malloc(struct reiserfs_node)\n");
MALLOC(ip, struct reiserfs_node *, sizeof(struct reiserfs_node),
ip = malloc(sizeof(struct reiserfs_node),
M_REISERFSNODE, M_WAITOK | M_ZERO);
/* Fill the structure */

View File

@ -437,14 +437,14 @@ user_ldt_alloc(struct mdproc *mdp, int len)
mtx_assert(&dt_lock, MA_OWNED);
mtx_unlock_spin(&dt_lock);
MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt),
new_ldt = malloc(sizeof(struct proc_ldt),
M_SUBPROC, M_WAITOK);
new_ldt->ldt_len = len = NEW_MAX_LD(len);
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
round_page(len * sizeof(union descriptor)));
if (new_ldt->ldt_base == NULL) {
FREE(new_ldt, M_SUBPROC);
free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock);
return (NULL);
}
@ -474,14 +474,14 @@ user_ldt_alloc(struct mdproc *mdp, int len)
mtx_assert(&dt_lock, MA_OWNED);
mtx_unlock_spin(&dt_lock);
MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt),
new_ldt = malloc(sizeof(struct proc_ldt),
M_SUBPROC, M_WAITOK);
new_ldt->ldt_len = len = NEW_MAX_LD(len);
new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
len * sizeof(union descriptor));
if (new_ldt->ldt_base == NULL) {
FREE(new_ldt, M_SUBPROC);
free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock);
return (NULL);
}
@ -538,7 +538,7 @@ user_ldt_deref(struct proc_ldt *pldt)
mtx_unlock_spin(&dt_lock);
kmem_free(kernel_map, (vm_offset_t)pldt->ldt_base,
pldt->ldt_len * sizeof(union descriptor));
FREE(pldt, M_SUBPROC);
free(pldt, M_SUBPROC);
} else
mtx_unlock_spin(&dt_lock);
}
@ -815,7 +815,7 @@ i386_ldt_grow(struct thread *td, int len)
kmem_free(kernel_map,
(vm_offset_t)new_ldt->ldt_base,
new_ldt->ldt_len * sizeof(union descriptor));
FREE(new_ldt, M_SUBPROC);
free(new_ldt, M_SUBPROC);
mtx_lock_spin(&dt_lock);
return (0);
}
@ -848,7 +848,7 @@ i386_ldt_grow(struct thread *td, int len)
if (old_ldt_base != NULL_LDT_BASE) {
kmem_free(kernel_map, (vm_offset_t)old_ldt_base,
old_ldt_len * sizeof(union descriptor));
FREE(new_ldt, M_SUBPROC);
free(new_ldt, M_SUBPROC);
}
mtx_lock_spin(&dt_lock);
}

View File

@ -165,7 +165,7 @@ ssccreate(int unit)
if (sc->unit == unit)
return (NULL);
}
MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_WAITOK | M_ZERO);
sc = malloc(sizeof(*sc), M_SSC, M_WAITOK | M_ZERO);
LIST_INSERT_HEAD(&ssc_softc_list, sc, list);
sc->unit = unit;
bioq_init(&sc->bio_queue);

View File

@ -852,7 +852,7 @@ funsetown(struct sigio **sigiop)
}
SIGIO_UNLOCK();
crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO);
free(sigio, M_SIGIO);
}
/*
@ -910,7 +910,7 @@ funsetownlst(struct sigiolst *sigiolst)
}
SIGIO_UNLOCK();
crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO);
free(sigio, M_SIGIO);
SIGIO_LOCK();
}
SIGIO_UNLOCK();
@ -938,7 +938,7 @@ fsetown(pid_t pgid, struct sigio **sigiop)
ret = 0;
/* Allocate and fill in the new sigio out of locks. */
MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, M_WAITOK);
sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK);
sigio->sio_pgid = pgid;
sigio->sio_ucred = crhold(curthread->td_ucred);
sigio->sio_myref = sigiop;
@ -1020,7 +1020,7 @@ fsetown(pid_t pgid, struct sigio **sigiop)
fail:
sx_sunlock(&proctree_lock);
crfree(sigio->sio_ucred);
FREE(sigio, M_SIGIO);
free(sigio, M_SIGIO);
return (ret);
}
@ -1287,11 +1287,11 @@ fdgrowtable(struct filedesc *fdp, int nfd)
/* allocate a new table and (if required) new bitmaps */
FILEDESC_XUNLOCK(fdp);
MALLOC(ntable, struct file **, nnfiles * OFILESIZE,
ntable = malloc(nnfiles * OFILESIZE,
M_FILEDESC, M_ZERO | M_WAITOK);
nfileflags = (char *)&ntable[nnfiles];
if (NDSLOTS(nnfiles) > NDSLOTS(onfiles))
MALLOC(nmap, NDSLOTTYPE *, NDSLOTS(nnfiles) * NDSLOTSIZE,
nmap = malloc(NDSLOTS(nnfiles) * NDSLOTSIZE,
M_FILEDESC, M_ZERO | M_WAITOK);
else
nmap = NULL;
@ -1521,7 +1521,7 @@ fddrop(struct filedesc *fdp)
return;
FILEDESC_LOCK_DESTROY(fdp);
FREE(fdp, M_FILEDESC);
free(fdp, M_FILEDESC);
}
/*
@ -1696,7 +1696,7 @@ fdfree(struct thread *td)
td->td_proc->p_fdtol = NULL;
FILEDESC_XUNLOCK(fdp);
if (fdtol != NULL)
FREE(fdtol, M_FILEDESC_TO_LEADER);
free(fdtol, M_FILEDESC_TO_LEADER);
}
FILEDESC_XLOCK(fdp);
i = --fdp->fd_refcnt;
@ -1720,9 +1720,9 @@ fdfree(struct thread *td)
mtx_unlock(&fdesc_mtx);
if (fdp->fd_nfiles > NDFILE)
FREE(fdp->fd_ofiles, M_FILEDESC);
free(fdp->fd_ofiles, M_FILEDESC);
if (NDSLOTS(fdp->fd_nfiles) > NDSLOTS(NDFILE))
FREE(fdp->fd_map, M_FILEDESC);
free(fdp->fd_map, M_FILEDESC);
fdp->fd_nfiles = 0;
@ -2409,8 +2409,7 @@ filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp, s
{
struct filedesc_to_leader *fdtol;
MALLOC(fdtol, struct filedesc_to_leader *,
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,7 +529,7 @@ filt_timerattach(struct knote *kn)
kn->kn_flags |= EV_CLEAR; /* automatically set */
kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */
MALLOC(calloutp, struct callout *, sizeof(*calloutp),
calloutp = malloc(sizeof(*calloutp),
M_KQUEUE, M_WAITOK);
callout_init(calloutp, CALLOUT_MPSAFE);
kn->kn_hook = calloutp;
@ -547,7 +547,7 @@ filt_timerdetach(struct knote *kn)
calloutp = (struct callout *)kn->kn_hook;
callout_drain(calloutp);
FREE(calloutp, M_KQUEUE);
free(calloutp, M_KQUEUE);
atomic_add_int(&kq_ncallouts, -1);
kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */
}
@ -1109,19 +1109,18 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
size = kq->kq_knlistsize;
while (size <= fd)
size += KQEXTENT;
MALLOC(list, struct klist *,
size * sizeof list, M_KQUEUE, mflag);
list = malloc( size * sizeof list, M_KQUEUE, mflag);
if (list == NULL)
return ENOMEM;
KQ_LOCK(kq);
if (kq->kq_knlistsize > fd) {
FREE(list, M_KQUEUE);
free(list, M_KQUEUE);
list = NULL;
} else {
if (kq->kq_knlist != NULL) {
bcopy(kq->kq_knlist, list,
kq->kq_knlistsize * sizeof list);
FREE(kq->kq_knlist, M_KQUEUE);
free(kq->kq_knlist, M_KQUEUE);
kq->kq_knlist = NULL;
}
bzero((caddr_t)list +

View File

@ -137,7 +137,7 @@ jail(struct thread *td, struct jail_args *uap)
if (j.version != 0)
return (EINVAL);
MALLOC(pr, struct prison *, sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO);
pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO);
mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF);
pr->pr_ref = 1;
error = copyinstr(j.path, &pr->pr_path, sizeof(pr->pr_path), 0);
@ -211,13 +211,13 @@ jail(struct thread *td, struct jail_args *uap)
sx_sunlock(&allprison_lock);
e_dropvnref:
if (pr->pr_slots != NULL)
FREE(pr->pr_slots, M_PRISON);
free(pr->pr_slots, M_PRISON);
vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount);
vrele(pr->pr_root);
VFS_UNLOCK_GIANT(vfslocked);
e_killmtx:
mtx_destroy(&pr->pr_mtx);
FREE(pr, M_PRISON);
free(pr, M_PRISON);
return (error);
}
@ -343,7 +343,7 @@ prison_complete(void *context, int pending)
}
sx_sunlock(&allprison_lock);
if (pr->pr_slots != NULL)
FREE(pr->pr_slots, M_PRISON);
free(pr->pr_slots, M_PRISON);
vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount);
vrele(pr->pr_root);
@ -351,8 +351,8 @@ prison_complete(void *context, int pending)
mtx_destroy(&pr->pr_mtx);
if (pr->pr_linux != NULL)
FREE(pr->pr_linux, M_PRISON);
FREE(pr, M_PRISON);
free(pr->pr_linux, M_PRISON);
free(pr, M_PRISON);
}
void

View File

@ -1893,14 +1893,13 @@ linker_hwpmc_list_objects(void)
retry:
/* allocate nmappings+1 entries */
MALLOC(hc.kobase, struct pmckern_map_in *,
(hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER,
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) {
hc.nmappings = hc.nobjects;
FREE(hc.kobase, M_LINKER);
free(hc.kobase, M_LINKER);
goto retry;
}

View File

@ -146,8 +146,7 @@ mtx_pool_create(const char *mtx_name, int pool_size, int opts)
mtx_name);
pool_size = 128;
}
MALLOC(pool, struct mtx_pool *,
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;
@ -161,7 +160,7 @@ mtx_pool_destroy(struct mtx_pool **poolp)
for (i = pool->mtx_pool_size - 1; i >= 0; --i)
mtx_destroy(&pool->mtx_pool_ary[i]);
FREE(pool, M_MTXPOOL);
free(pool, M_MTXPOOL);
*poolp = NULL;
}
@ -208,7 +207,7 @@ mtx_pool_alloc(struct mtx_pool *pool)
* memory allocator. The lockmgr subsystem is initialized by
* SYSINIT(..., SI_SUB_LOCKMGR, ...).
*
* We can't call MALLOC() to dynamically allocate the sleep pool
* We can't call malloc() to dynamically allocate the sleep pool
* until after kmeminit() has been called, which is done by
* SYSINIT(..., SI_SUB_KMEM, ...).
*/

View File

@ -509,7 +509,7 @@ pgdelete(pgrp)
}
mtx_destroy(&pgrp->pg_mtx);
FREE(pgrp, M_PGRP);
free(pgrp, M_PGRP);
sess_release(savesess);
}
@ -629,7 +629,7 @@ sess_release(struct session *s)
tty_rel_sess(s->s_ttyp, s);
}
mtx_destroy(&s->s_mtx);
FREE(s, M_SESSION);
free(s, M_SESSION);
}
}
@ -1173,7 +1173,7 @@ pargs_alloc(int len)
{
struct pargs *pa;
MALLOC(pa, struct pargs *, sizeof(struct pargs) + len, M_PARGS,
pa = malloc(sizeof(struct pargs) + len, M_PARGS,
M_WAITOK);
refcount_init(&pa->ar_ref, 1);
pa->ar_length = len;
@ -1184,7 +1184,7 @@ static void
pargs_free(struct pargs *pa)
{
FREE(pa, M_PARGS);
free(pa, M_PARGS);
}
void

View File

@ -326,8 +326,8 @@ setsid(register struct thread *td, struct setsid_args *uap)
error = 0;
pgrp = NULL;
MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO);
newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
newsess = malloc(sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO);
sx_xlock(&proctree_lock);
@ -345,9 +345,9 @@ setsid(register struct thread *td, struct setsid_args *uap)
sx_xunlock(&proctree_lock);
if (newpgrp != NULL)
FREE(newpgrp, M_PGRP);
free(newpgrp, M_PGRP);
if (newsess != NULL)
FREE(newsess, M_SESSION);
free(newsess, M_SESSION);
return (error);
}
@ -386,7 +386,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap)
error = 0;
MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
sx_xlock(&proctree_lock);
if (uap->pid != 0 && uap->pid != curp->p_pid) {
@ -450,7 +450,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap)
KASSERT((error == 0) || (newpgrp != NULL),
("setpgid failed and newpgrp is NULL"));
if (newpgrp != NULL)
FREE(newpgrp, M_PGRP);
free(newpgrp, M_PGRP);
return (error);
}
@ -1778,7 +1778,7 @@ crget(void)
{
register struct ucred *cr;
MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
cr = malloc(sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
refcount_init(&cr->cr_ref, 1);
#ifdef AUDIT
audit_cred_init(cr);
@ -1830,7 +1830,7 @@ crfree(struct ucred *cr)
#ifdef MAC
mac_cred_destroy(cr);
#endif
FREE(cr, M_CRED);
free(cr, M_CRED);
}
}

View File

@ -1268,7 +1268,7 @@ uifree(uip)
if (uip->ui_proccnt != 0)
printf("freeing uidinfo: uid = %d, proccnt = %ld\n",
uip->ui_uid, uip->ui_proccnt);
FREE(uip, M_UIDINFO);
free(uip, M_UIDINFO);
return;
}
/*

View File

@ -554,7 +554,7 @@ blst_meta_free(
int next_skip = ((u_int)skip / BLIST_META_RADIX);
#if 0
printf("FREE (%llx,%lld) FROM (%llx,%lld)\n",
printf("free (%llx,%lld) FROM (%llx,%lld)\n",
(long long)freeBlk, (long long)count,
(long long)blk, (long long)radix
);

View File

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

View File

@ -84,7 +84,7 @@ accept_filt_add(struct accept_filter *filt)
} else {
p->accf_callback = filt->accf_callback;
ACCEPT_FILTER_UNLOCK();
FREE(filt, M_ACCF);
free(filt, M_ACCF);
return (0);
}
}
@ -131,7 +131,7 @@ accept_filt_generic_mod_event(module_t mod, int event, void *data)
switch (event) {
case MOD_LOAD:
MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF,
p = malloc(sizeof(*p), M_ACCF,
M_WAITOK);
bcopy(accfp, p, sizeof(*p));
error = accept_filt_add(p);
@ -169,7 +169,7 @@ do_getopt_accept_filter(struct socket *so, struct sockopt *sopt)
int error;
error = 0;
MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP,
afap = malloc(sizeof(*afap), M_TEMP,
M_WAITOK | M_ZERO);
SOCK_LOCK(so);
if ((so->so_options & SO_ACCEPTCONN) == 0) {
@ -187,7 +187,7 @@ do_getopt_accept_filter(struct socket *so, struct sockopt *sopt)
SOCK_UNLOCK(so);
if (error == 0)
error = sooptcopyout(sopt, afap, sizeof(*afap));
FREE(afap, M_TEMP);
free(afap, M_TEMP);
return (error);
}
@ -215,8 +215,8 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
af->so_accept_filter->accf_destroy(so);
}
if (af->so_accept_filter_str != NULL)
FREE(af->so_accept_filter_str, M_ACCF);
FREE(af, M_ACCF);
free(af->so_accept_filter_str, M_ACCF);
free(af, M_ACCF);
so->so_accf = NULL;
}
so->so_options &= ~SO_ACCEPTFILTER;
@ -228,18 +228,18 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
* Pre-allocate any memory we may need later to avoid blocking at
* untimely moments. This does not optimize for invalid arguments.
*/
MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP,
afap = malloc(sizeof(*afap), M_TEMP,
M_WAITOK);
error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap);
afap->af_name[sizeof(afap->af_name)-1] = '\0';
afap->af_arg[sizeof(afap->af_arg)-1] = '\0';
if (error) {
FREE(afap, M_TEMP);
free(afap, M_TEMP);
return (error);
}
afp = accept_filt_get(afap->af_name);
if (afp == NULL) {
FREE(afap, M_TEMP);
free(afap, M_TEMP);
return (ENOENT);
}
/*
@ -248,11 +248,11 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
* attached properly, 'newaf' is NULLed to avoid a free()
* while in use.
*/
MALLOC(newaf, struct so_accf *, sizeof(*newaf), M_ACCF, M_WAITOK |
newaf = malloc(sizeof(*newaf), M_ACCF, M_WAITOK |
M_ZERO);
if (afp->accf_create != NULL && afap->af_name[0] != '\0') {
int len = strlen(afap->af_name) + 1;
MALLOC(newaf->so_accept_filter_str, char *, len, M_ACCF,
newaf->so_accept_filter_str = malloc(len, M_ACCF,
M_WAITOK);
strcpy(newaf->so_accept_filter_str, afap->af_name);
}
@ -289,10 +289,10 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
SOCK_UNLOCK(so);
if (newaf != NULL) {
if (newaf->so_accept_filter_str != NULL)
FREE(newaf->so_accept_filter_str, M_ACCF);
FREE(newaf, M_ACCF);
free(newaf->so_accept_filter_str, M_ACCF);
free(newaf, M_ACCF);
}
if (afap != NULL)
FREE(afap, M_TEMP);
free(afap, M_TEMP);
return (error);
}

View File

@ -1545,7 +1545,7 @@ mqueue_free(struct mqueue *mq)
while ((msg = TAILQ_FIRST(&mq->mq_msgq)) != NULL) {
TAILQ_REMOVE(&mq->mq_msgq, msg, msg_link);
FREE(msg, M_MQUEUEDATA);
free(msg, M_MQUEUEDATA);
}
mtx_destroy(&mq->mq_mutex);
@ -1566,11 +1566,11 @@ mqueue_loadmsg(const char *msg_ptr, size_t msg_size, int msg_prio)
int error;
len = sizeof(struct mqueue_msg) + msg_size;
MALLOC(msg, struct mqueue_msg *, len, M_MQUEUEDATA, M_WAITOK);
msg = malloc(len, M_MQUEUEDATA, M_WAITOK);
error = copyin(msg_ptr, ((char *)msg) + sizeof(struct mqueue_msg),
msg_size);
if (error) {
FREE(msg, M_MQUEUEDATA);
free(msg, M_MQUEUEDATA);
msg = NULL;
} else {
msg->msg_size = msg_size;
@ -1600,7 +1600,7 @@ mqueue_savemsg(struct mqueue_msg *msg, char *msg_ptr, int *msg_prio)
static __inline void
mqueue_freemsg(struct mqueue_msg *msg)
{
FREE(msg, M_MQUEUEDATA);
free(msg, M_MQUEUEDATA);
}
/*

View File

@ -457,7 +457,7 @@ kern_accept(struct thread *td, int s, struct sockaddr **name,
}
noconnection:
if (sa)
FREE(sa, M_SONAME);
free(sa, M_SONAME);
/*
* close the new descriptor, assuming someone hasn't ripped it
@ -720,7 +720,7 @@ sendit(td, s, mp, flags)
bad:
if (to)
FREE(to, M_SONAME);
free(to, M_SONAME);
return (error);
}
@ -1068,7 +1068,7 @@ kern_recvit(td, s, mp, fromseg, controlp)
ktrsockaddr(fromsa);
#endif
if (fromsa)
FREE(fromsa, M_SONAME);
free(fromsa, M_SONAME);
if (error == 0 && controlp != NULL)
*controlp = control;
@ -1661,10 +1661,10 @@ getsockaddr(namp, uaddr, len)
return (ENAMETOOLONG);
if (len < offsetof(struct sockaddr, sa_data[0]))
return (EINVAL);
MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK);
sa = malloc(len, M_SONAME, M_WAITOK);
error = copyin(uaddr, sa, len);
if (error) {
FREE(sa, M_SONAME);
free(sa, M_SONAME);
} else {
#if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN
if (sa->sa_family == 0 && sa->sa_len < AF_MAX)

View File

@ -600,7 +600,7 @@ uipc_detach(struct socket *so)
unp->unp_refcount--;
freeunp = (unp->unp_refcount == 0);
if (saved_unp_addr != NULL)
FREE(saved_unp_addr, M_SONAME);
free(saved_unp_addr, M_SONAME);
if (freeunp) {
UNP_PCB_LOCK_DESTROY(unp);
uma_zfree(unp_zone, unp);

View File

@ -330,7 +330,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
if (nfs_pub.np_valid) {
nfs_pub.np_valid = 0;
if (nfs_pub.np_index != NULL) {
FREE(nfs_pub.np_index, M_TEMP);
free(nfs_pub.np_index, M_TEMP);
nfs_pub.np_index = NULL;
}
}
@ -361,7 +361,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
* If an indexfile was specified, pull it in.
*/
if (argp->ex_indexfile != NULL) {
MALLOC(nfs_pub.np_index, char *, MAXNAMLEN + 1, M_TEMP,
nfs_pub.np_index = malloc(MAXNAMLEN + 1, M_TEMP,
M_WAITOK);
error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
MAXNAMLEN, (size_t *)0);
@ -377,7 +377,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
}
}
if (error) {
FREE(nfs_pub.np_index, M_TEMP);
free(nfs_pub.np_index, M_TEMP);
return (error);
}
}

View File

@ -3928,7 +3928,7 @@ ogetdirentries(td, uap)
kuio.uio_iov = &kiov;
kuio.uio_segflg = UIO_SYSSPACE;
kiov.iov_len = uap->count;
MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK);
dirbuf = malloc(uap->count, M_TEMP, M_WAITOK);
kiov.iov_base = dirbuf;
error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
NULL, NULL);
@ -3965,7 +3965,7 @@ ogetdirentries(td, uap)
if (dp >= edp)
error = uiomove(dirbuf, readcnt, &auio);
}
FREE(dirbuf, M_TEMP);
free(dirbuf, M_TEMP);
}
if (error) {
VOP_UNLOCK(vp, 0);

View File

@ -619,7 +619,7 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td)
struct bpf_d *d;
int error;
MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
error = devfs_set_cdevpriv(d, bpf_dtor);
if (error != 0) {
free(d, M_BPF);

View File

@ -346,7 +346,7 @@ bsd_alloc(options, opt_len, decomp)
maxmaxcode = MAXCODE(bits);
newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
MALLOC(db, struct bsd_db *, newlen, M_DEVBUF, M_NOWAIT);
db = malloc(newlen, M_DEVBUF, M_NOWAIT);
if (!db)
return NULL;
bzero(db, sizeof(*db) - sizeof(db->dict));
@ -354,7 +354,7 @@ bsd_alloc(options, opt_len, decomp)
if (!decomp) {
db->lens = NULL;
} else {
MALLOC(db->lens, u_int16_t *, (maxmaxcode+1) * sizeof(db->lens[0]),
db->lens = malloc((maxmaxcode+1) * sizeof(db->lens[0]),
M_DEVBUF, M_NOWAIT);
if (!db->lens) {
free(db, M_DEVBUF);

View File

@ -2299,14 +2299,14 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
struct ifmultiaddr *ifma;
struct sockaddr *dupsa;
MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, mflags |
ifma = malloc(sizeof *ifma, M_IFMADDR, mflags |
M_ZERO);
if (ifma == NULL)
return (NULL);
MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, mflags);
dupsa = malloc(sa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) {
FREE(ifma, M_IFMADDR);
free(ifma, M_IFMADDR);
return (NULL);
}
bcopy(sa, dupsa, sa->sa_len);
@ -2321,10 +2321,10 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
return (ifma);
}
MALLOC(dupsa, struct sockaddr *, llsa->sa_len, M_IFMADDR, mflags);
dupsa = malloc(llsa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) {
FREE(ifma->ifma_addr, M_IFMADDR);
FREE(ifma, M_IFMADDR);
free(ifma->ifma_addr, M_IFMADDR);
free(ifma, M_IFMADDR);
return (NULL);
}
bcopy(llsa, dupsa, llsa->sa_len);
@ -2349,9 +2349,9 @@ if_freemulti(struct ifmultiaddr *ifma)
("if_freemulti: protospec not NULL"));
if (ifma->ifma_lladdr != NULL)
FREE(ifma->ifma_lladdr, M_IFMADDR);
FREE(ifma->ifma_addr, M_IFMADDR);
FREE(ifma, M_IFMADDR);
free(ifma->ifma_lladdr, M_IFMADDR);
free(ifma->ifma_addr, M_IFMADDR);
free(ifma, M_IFMADDR);
}
/*
@ -2469,13 +2469,13 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa,
}
if (llsa != NULL)
FREE(llsa, M_IFMADDR);
free(llsa, M_IFMADDR);
return (0);
free_llsa_out:
if (llsa != NULL)
FREE(llsa, M_IFMADDR);
free(llsa, M_IFMADDR);
unlock_out:
IF_ADDR_UNLOCK(ifp);

View File

@ -778,7 +778,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return ENOMEM;
@ -806,7 +806,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return ENOMEM;

View File

@ -1124,7 +1124,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return ENOMEM;
@ -1153,7 +1153,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL;
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);

View File

@ -718,7 +718,7 @@ fddi_resolvemulti(ifp, llsa, sa)
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return (EADDRNOTAVAIL);
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return (ENOMEM);
@ -749,7 +749,7 @@ fddi_resolvemulti(ifp, llsa, sa)
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return (EADDRNOTAVAIL);
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return (ENOMEM);

View File

@ -720,7 +720,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
return (EADDRNOTAVAIL);
}
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);
@ -750,7 +750,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
return (EADDRNOTAVAIL);
}
MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);

View File

@ -348,7 +348,7 @@ pppalloc(pid)
sc->sc_relinq = NULL;
bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats));
#ifdef VJC
MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress),
sc->sc_comp = malloc(sizeof(struct slcompress),
M_DEVBUF, M_NOWAIT);
if (sc->sc_comp)
sl_compress_init(sc->sc_comp, -1);
@ -614,7 +614,7 @@ pppioctl(sc, cmd, data, flag, td)
}
newcodelen = nbp->bf_len * sizeof(struct bpf_insn);
if (newcodelen != 0) {
MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK);
newcode = malloc(newcodelen, M_DEVBUF, M_WAITOK);
if (newcode == 0) {
error = EINVAL; /* or sumpin */
break;

View File

@ -271,7 +271,7 @@ slmarkstatic(int unit)
if (slisstatic(unit))
return;
MALLOC(t, int *, sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT);
t = malloc(sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT);
if (t == NULL)
return;
@ -291,7 +291,7 @@ slcreate(void)
int unit;
struct mbuf *m;
MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO);
sc = malloc(sizeof(*sc), M_SL, M_WAITOK | M_ZERO);
sc->sc_ifp = if_alloc(IFT_SLIP);
if (sc->sc_ifp == NULL) {
free(sc, M_SL);
@ -664,8 +664,7 @@ sltstart(struct tty *tp)
register u_char *cp;
if (sc->bpfbuf == NULL)
MALLOC(sc->bpfbuf, u_char *,
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

@ -412,7 +412,7 @@ tapcreate(struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE;
/* allocate driver storage and create device */
MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
tp = malloc(sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
mtx_init(&tp->tap_mtx, "tap_mtx", NULL, MTX_DEF);
mtx_lock(&tapmtx);
SLIST_INSERT_HEAD(&taphead, tp, tap_next);

View File

@ -363,7 +363,7 @@ tuncreate(const char *name, struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE;
MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF);
sc->tun_flags = TUN_INITED;
sc->tun_dev = dev;

View File

@ -126,7 +126,7 @@ z_alloc(notused, items, size)
{
void *ptr;
MALLOC(ptr, void *, items * size, M_DEVBUF, M_NOWAIT);
ptr = malloc(items * size, M_DEVBUF, M_NOWAIT);
return ptr;
}
@ -159,7 +159,7 @@ z_comp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT);
if (state == NULL)
return NULL;
@ -389,7 +389,7 @@ z_decomp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT);
if (state == NULL)
return NULL;

View File

@ -169,7 +169,7 @@ rts_attach(struct socket *so, int proto, struct thread *td)
KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
/* XXX */
MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
if (rp == NULL)
return ENOBUFS;

View File

@ -99,7 +99,7 @@ acl_attach(struct ieee80211vap *vap)
{
struct aclstate *as;
MALLOC(as, struct aclstate *, sizeof(struct aclstate),
as = malloc(sizeof(struct aclstate),
M_80211_ACL, M_NOWAIT | M_ZERO);
if (as == NULL)
return 0;
@ -123,7 +123,7 @@ acl_detach(struct ieee80211vap *vap)
acl_free_all(vap);
vap->iv_as = NULL;
ACL_LOCK_DESTROY(as);
FREE(as, M_80211_ACL);
free(as, M_80211_ACL);
}
static __inline struct acl *
@ -147,7 +147,7 @@ _acl_free(struct aclstate *as, struct acl *acl)
TAILQ_REMOVE(&as->as_list, acl, acl_list);
LIST_REMOVE(acl, acl_hash);
FREE(acl, M_80211_ACL);
free(acl, M_80211_ACL);
as->as_nacls--;
}
@ -175,7 +175,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
struct acl *acl, *new;
int hash;
MALLOC(new, struct acl *, sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO);
new = malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO);
if (new == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, no memory\n", ether_sprintf(mac));
@ -188,7 +188,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) {
if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) {
ACL_UNLOCK(as);
FREE(new, M_80211_ACL);
free(new, M_80211_ACL);
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, already present\n",
ether_sprintf(mac));
@ -301,7 +301,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space; /* return required space */
return 0; /* NB: must not error */
}
MALLOC(ap, struct ieee80211req_maclist *, space,
ap = malloc(space,
M_TEMP, M_NOWAIT);
if (ap == NULL)
return ENOMEM;
@ -317,7 +317,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space;
} else
error = copyout(ap, ireq->i_data, ireq->i_len);
FREE(ap, M_TEMP);
free(ap, M_TEMP);
return error;
}
return EINVAL;

View File

@ -96,7 +96,7 @@ ccmp_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct ccmp_ctx *ctx;
MALLOC(ctx, struct ccmp_ctx *, sizeof(struct ccmp_ctx),
ctx = malloc(sizeof(struct ccmp_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -113,7 +113,7 @@ ccmp_detach(struct ieee80211_key *k)
{
struct ccmp_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -109,7 +109,7 @@ tkip_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct tkip_ctx *ctx;
MALLOC(ctx, struct tkip_ctx *, sizeof(struct tkip_ctx),
ctx = malloc(sizeof(struct tkip_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -126,7 +126,7 @@ tkip_detach(struct ieee80211_key *k)
{
struct tkip_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -87,7 +87,7 @@ wep_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct wep_ctx *ctx;
MALLOC(ctx, struct wep_ctx *, sizeof(struct wep_ctx),
ctx = malloc(sizeof(struct wep_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -106,7 +106,7 @@ wep_detach(struct ieee80211_key *k)
{
struct wep_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -234,7 +234,7 @@ ieee80211_sysctl_vattach(struct ieee80211vap *vap)
struct sysctl_oid *oid;
char num[14]; /* sufficient for 32 bits */
MALLOC(ctx, struct sysctl_ctx_list *, sizeof(struct sysctl_ctx_list),
ctx = malloc(sizeof(struct sysctl_ctx_list),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
if_printf(ifp, "%s: cannot allocate sysctl context!\n",
@ -310,7 +310,7 @@ ieee80211_sysctl_vdetach(struct ieee80211vap *vap)
if (vap->iv_sysctl != NULL) {
sysctl_ctx_free(vap->iv_sysctl);
FREE(vap->iv_sysctl, M_DEVBUF);
free(vap->iv_sysctl, M_DEVBUF);
vap->iv_sysctl = NULL;
}
}

View File

@ -902,7 +902,7 @@ hostap_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
* open auth is attempted.
*/
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
/* XXX hack to workaround calling convention */
@ -1986,7 +1986,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
return;
/* discard challenge after association */
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
/* NB: 802.11 spec says to ignore station's privacy bit */

View File

@ -499,7 +499,7 @@ int
ieee80211_alloc_challenge(struct ieee80211_node *ni)
{
if (ni->ni_challenge == NULL)
MALLOC(ni->ni_challenge, uint32_t*, IEEE80211_CHALLENGE_LEN,
ni->ni_challenge = malloc(IEEE80211_CHALLENGE_LEN,
M_80211_NODE, M_NOWAIT);
if (ni->ni_challenge == NULL) {
IEEE80211_NOTE(ni->ni_vap,

Some files were not shown because too many files have changed in this diff Show More