From 9e8577e7fffeab9111fc01d9e1c7ca42905be86a Mon Sep 17 00:00:00 2001 From: tedu Date: Sat, 12 Jul 2014 18:43:32 +0000 Subject: [PATCH] add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis. --- sys/kern/exec_elf.c | 20 ++++++++++---------- sys/kern/exec_script.c | 6 +++--- sys/kern/exec_subr.c | 8 ++++---- sys/kern/kern_bufq.c | 6 +++--- sys/kern/kern_descrip.c | 18 +++++++++--------- sys/kern/kern_event.c | 6 +++--- sys/kern/kern_exec.c | 16 ++++++++-------- sys/kern/kern_exit.c | 4 ++-- sys/kern/kern_fork.c | 4 ++-- sys/kern/kern_kthread.c | 4 ++-- sys/kern/kern_ktrace.c | 10 +++++----- sys/kern/kern_lkm.c | 4 ++-- sys/kern/kern_malloc.c | 4 ++-- sys/kern/kern_proc.c | 4 ++-- sys/kern/kern_sensors.c | 4 ++-- sys/kern/kern_subr.c | 6 +++--- sys/kern/kern_sysctl.c | 20 ++++++++++---------- sys/kern/kern_task.c | 6 +++--- sys/kern/kern_tc.c | 4 ++-- sys/kern/kern_workq.c | 6 +++--- sys/kern/subr_autoconf.c | 14 +++++++------- sys/kern/subr_disk.c | 4 ++-- sys/kern/subr_extent.c | 6 +++--- sys/kern/subr_log.c | 4 ++-- sys/kern/subr_userconf.c | 4 ++-- sys/kern/sys_generic.c | 16 ++++++++-------- sys/kern/sys_process.c | 14 +++++++------- sys/kern/sysv_msg.c | 10 +++++----- sys/kern/sysv_sem.c | 16 ++++++++-------- sys/kern/sysv_shm.c | 8 ++++---- sys/kern/tty.c | 8 ++++---- sys/kern/tty_endrun.c | 6 +++--- sys/kern/tty_msts.c | 6 +++--- sys/kern/tty_nmea.c | 6 +++--- sys/kern/tty_pty.c | 4 ++-- sys/kern/tty_subr.c | 6 +++--- sys/kern/uipc_syscalls.c | 10 +++++----- sys/kern/uipc_usrreq.c | 16 ++++++++-------- sys/kern/vfs_bio.c | 6 +++--- sys/kern/vfs_cluster.c | 6 +++--- sys/kern/vfs_getcwd.c | 6 +++--- sys/kern/vfs_subr.c | 12 ++++++------ sys/kern/vfs_syscalls.c | 6 +++--- sys/kern/vfs_vnops.c | 4 ++-- sys/sys/malloc.h | 4 ++-- 45 files changed, 181 insertions(+), 181 deletions(-) diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index 5d7f006a28b..7df3832810e 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.98 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.99 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -490,7 +490,7 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp, bad1: VOP_CLOSE(nd.ni_vp, FREAD, p->p_ucred, p); bad: - free(ph, M_TEMP); + free(ph, M_TEMP, 0); *last = addr; vput(nd.ni_vp); @@ -750,14 +750,14 @@ ELFNAME2(exec,makecmds)(struct proc *p, struct exec_package *epp) epp->ep_interp_pos = pos; } - free(ph, M_TEMP); + free(ph, M_TEMP, 0); vn_marktext(epp->ep_vp); return (exec_setup_stack(p, epp)); bad: if (interp) pool_put(&namei_pool, interp); - free(ph, M_TEMP); + free(ph, M_TEMP, 0); kill_vmcmds(&epp->ep_vmcmds); return (ENOEXEC); } @@ -783,7 +783,7 @@ ELFNAME2(exec,fixup)(struct proc *p, struct exec_package *epp) ap = epp->ep_emul_arg; if ((error = ELFNAME(load_file)(p, interp, epp, ap, &pos)) != 0) { - free(ap, M_TEMP); + free(ap, M_TEMP, 0); pool_put(&namei_pool, interp); kill_vmcmds(&epp->ep_vmcmds); return (error); @@ -834,7 +834,7 @@ ELFNAME2(exec,fixup)(struct proc *p, struct exec_package *epp) error = copyout(ai, epp->ep_emul_argp, sizeof ai); } - free(ap, M_TEMP); + free(ap, M_TEMP, 0); pool_put(&namei_pool, interp); return (error); } @@ -879,7 +879,7 @@ ELFNAME(os_pt_note)(struct proc *p, struct exec_package *epp, Elf_Ehdr *eh, #if 0 if (np->type != ELF_NOTE_TYPE_OSVERSION) { - free(np, M_TEMP); + free(np, M_TEMP, 0); np = NULL; continue; } @@ -902,9 +902,9 @@ ELFNAME(os_pt_note)(struct proc *p, struct exec_package *epp, Elf_Ehdr *eh, out3: error = ENOEXEC; out2: - free(np, M_TEMP); + free(np, M_TEMP, 0); out1: - free(hph, M_TEMP); + free(hph, M_TEMP, 0); return error; } @@ -1077,7 +1077,7 @@ ELFNAMEEND(coredump)(struct proc *p, void *cookie) } out: - free(psections, M_TEMP); + free(psections, M_TEMP, 0); return (error); #endif } diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index 6fab186676f..a8e327e3ba1 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_script.c,v 1.29 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: exec_script.c,v 1.30 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */ /* @@ -311,10 +311,10 @@ fail: /* free the fake arg list, because we're not returning it */ if ((tmpsap = shellargp) != NULL) { while (*tmpsap != NULL) { - free(*tmpsap, M_EXEC); + free(*tmpsap, M_EXEC, 0); tmpsap++; } - free(shellargp, M_EXEC); + free(shellargp, M_EXEC, 0); } /* diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c index a96deb31a5c..ae01762c5ba 100644 --- a/sys/kern/exec_subr.c +++ b/sys/kern/exec_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_subr.c,v 1.35 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: exec_subr.c,v 1.36 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */ /* @@ -95,7 +95,7 @@ vmcmdset_extend(struct exec_vmcmd_set *evsp) M_WAITOK); bcopy(evsp->evs_cmds, nvcp, (ocnt * sizeof(struct exec_vmcmd))); if (evsp->evs_cmds != evsp->evs_start) - free(evsp->evs_cmds, M_EXEC); + free(evsp->evs_cmds, M_EXEC, 0); evsp->evs_cmds = nvcp; } @@ -116,7 +116,7 @@ kill_vmcmds(struct exec_vmcmd_set *evsp) */ evsp->evs_used = 0; if (evsp->evs_cmds != evsp->evs_start) - free(evsp->evs_cmds, M_EXEC); + free(evsp->evs_cmds, M_EXEC, 0); evsp->evs_cmds = evsp->evs_start; evsp->evs_cnt = EXEC_DEFAULT_VMCMD_SETSIZE; } @@ -307,7 +307,7 @@ vmcmd_randomize(struct proc *p, struct exec_vmcmd *cmd) buf = malloc(cmd->ev_len, M_TEMP, M_WAITOK); arc4random_buf(buf, cmd->ev_len); error = copyout(buf, (void *)cmd->ev_addr, cmd->ev_len); - free(buf, M_TEMP); + free(buf, M_TEMP, 0); return (error); } diff --git a/sys/kern/kern_bufq.c b/sys/kern/kern_bufq.c index 1aeade20884..911fe1b5f3d 100644 --- a/sys/kern/kern_bufq.c +++ b/sys/kern/kern_bufq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_bufq.c,v 1.27 2014/06/27 16:38:03 miod Exp $ */ +/* $OpenBSD: kern_bufq.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson * Copyright (c) 2010 David Gwynne @@ -330,7 +330,7 @@ bufq_fifo_create(void) void bufq_fifo_destroy(void *data) { - free(data, M_DEVBUF); + free(data, M_DEVBUF, 0); } void @@ -447,7 +447,7 @@ bufq_nscan_create(void) void bufq_nscan_destroy(void *vdata) { - free(vdata, M_DEVBUF); + free(vdata, M_DEVBUF, 0); } void diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 6d9b15266fc..bd6c963cfe4 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.110 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.111 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -781,7 +781,7 @@ fdexpand(struct proc *p) memset(newofileflags + copylen, 0, nfiles * sizeof(char) - copylen); if (fdp->fd_nfiles > NDFILE) - free(fdp->fd_ofiles, M_FILEDESC); + free(fdp->fd_ofiles, M_FILEDESC, 0); if (NDHISLOTS(nfiles) > NDHISLOTS(fdp->fd_nfiles)) { newhimap = malloc(NDHISLOTS(nfiles) * sizeof(u_int), @@ -800,8 +800,8 @@ fdexpand(struct proc *p) NDLOSLOTS(nfiles) * sizeof(u_int) - copylen); if (NDHISLOTS(fdp->fd_nfiles) > NDHISLOTS(NDFILE)) { - free(fdp->fd_himap, M_FILEDESC); - free(fdp->fd_lomap, M_FILEDESC); + free(fdp->fd_himap, M_FILEDESC, 0); + free(fdp->fd_lomap, M_FILEDESC, 0); } fdp->fd_himap = newhimap; fdp->fd_lomap = newlomap; @@ -1015,19 +1015,19 @@ fdfree(struct proc *p) } p->p_fd = NULL; if (fdp->fd_nfiles > NDFILE) - free(fdp->fd_ofiles, M_FILEDESC); + free(fdp->fd_ofiles, M_FILEDESC, 0); if (NDHISLOTS(fdp->fd_nfiles) > NDHISLOTS(NDFILE)) { - free(fdp->fd_himap, M_FILEDESC); - free(fdp->fd_lomap, M_FILEDESC); + free(fdp->fd_himap, M_FILEDESC, 0); + free(fdp->fd_lomap, M_FILEDESC, 0); } if (fdp->fd_cdir) vrele(fdp->fd_cdir); if (fdp->fd_rdir) vrele(fdp->fd_rdir); if (fdp->fd_knlist) - free(fdp->fd_knlist, M_TEMP); + free(fdp->fd_knlist, M_TEMP, 0); if (fdp->fd_knhash) - free(fdp->fd_knhash, M_TEMP); + free(fdp->fd_knhash, M_TEMP, 0); pool_put(&fdesc_pool, fdp); } diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 15cc3c50491..ce309cf6dc1 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.57 2014/05/15 04:43:25 guenther Exp $ */ +/* $OpenBSD: kern_event.c,v 1.58 2014/07/12 18:43:32 tedu Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -376,7 +376,7 @@ filt_timerdetach(struct knote *kn) to = (struct timeout *)kn->kn_hook; timeout_del(to); - free(to, M_KEVENT); + free(to, M_KEVENT, 0); kq_ntimeouts--; } @@ -1027,7 +1027,7 @@ knote_attach(struct knote *kn, struct filedesc *fdp) memset(&list[fdp->fd_knlistsize], 0, (size - fdp->fd_knlistsize) * sizeof(struct klist)); if (fdp->fd_knlist != NULL) - free(fdp->fd_knlist, M_TEMP); + free(fdp->fd_knlist, M_TEMP, 0); fdp->fd_knlistsize = size; fdp->fd_knlist = list; } diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 3031c65b9be..5751a840085 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.143 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.144 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -336,10 +336,10 @@ sys_execve(struct proc *p, void *v, register_t *retval) *dp++ = *cp++; *dp++ = '\0'; - free(*tmpfap, M_EXEC); + free(*tmpfap, M_EXEC, 0); tmpfap++; argc++; } - free(pack.ep_fa, M_EXEC); + free(pack.ep_fa, M_EXEC, 0); pack.ep_flags &= ~EXEC_HASARGL; } @@ -662,7 +662,7 @@ sys_execve(struct proc *p, void *v, register_t *retval) if (pr->ps_flags & PS_TRACED) psignal(p, SIGTRAP); - free(pack.ep_hdr, M_EXEC); + free(pack.ep_hdr, M_EXEC, 0); /* * Call emulation specific exec hook. This can setup per-process @@ -724,14 +724,14 @@ bad: if (pack.ep_interp != NULL) pool_put(&namei_pool, pack.ep_interp); if (pack.ep_emul_arg != NULL) - free(pack.ep_emul_arg, M_TEMP); + free(pack.ep_emul_arg, M_TEMP, 0); /* close and put the exec'd file */ vn_close(pack.ep_vp, FREAD, cred, p); pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf); uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS); freehdr: - free(pack.ep_hdr, M_EXEC); + free(pack.ep_hdr, M_EXEC, 0); #if NSYSTRACE > 0 clrflag: #endif @@ -754,13 +754,13 @@ exec_abort: if (pack.ep_interp != NULL) pool_put(&namei_pool, pack.ep_interp); if (pack.ep_emul_arg != NULL) - free(pack.ep_emul_arg, M_TEMP); + free(pack.ep_emul_arg, M_TEMP, 0); pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf); vn_close(pack.ep_vp, FREAD, cred, p); uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS); free_pack_abort: - free(pack.ep_hdr, M_EXEC); + free(pack.ep_hdr, M_EXEC, 0); exit1(p, W_EXITCODE(0, SIGABRT), EXIT_NORMAL); /* NOTREACHED */ diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 24d9305bb6e..e4955619a1e 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.146 2014/07/11 08:18:31 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.147 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -658,7 +658,7 @@ process_zap(struct process *pr) KASSERT(pr->ps_refcnt == 1); if (pr->ps_ptstat != NULL) - free(pr->ps_ptstat, M_SUBPROC); + free(pr->ps_ptstat, M_SUBPROC, 0); pool_put(&rusage_pool, pr->ps_ru); KASSERT(TAILQ_EMPTY(&pr->ps_threads)); limfree(pr->ps_limit); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 712288a2408..2e035f17ab2 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.171 2014/07/11 08:20:42 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.172 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -493,7 +493,7 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr, p->p_cpu = arg; if (newptstat) - free(newptstat, M_SUBPROC); + free(newptstat, M_SUBPROC, 0); /* * Notify any interested parties about the new process. diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 8733f82cdb2..f70b0237799 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_kthread.c,v 1.35 2014/05/04 05:03:26 guenther Exp $ */ +/* $OpenBSD: kern_kthread.c,v 1.36 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */ /*- @@ -150,6 +150,6 @@ kthread_run_deferred_queue(void) while ((kq = SIMPLEQ_FIRST(&kthread_q)) != NULL) { SIMPLEQ_REMOVE_HEAD(&kthread_q, kq_q); (*kq->kq_func)(kq->kq_arg); - free(kq, M_TEMP); + free(kq, M_TEMP, 0); } } diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 5d308bcf694..71fb296cef6 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.66 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.67 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -175,7 +175,7 @@ ktrsyscall(struct proc *p, register_t code, size_t argsize, register_t args[]) memset(argp, 0, nargs * sizeof(int)); kth.ktr_len = len; ktrwrite(p, &kth, ktp); - free(ktp, M_TEMP); + free(ktp, M_TEMP, 0); atomic_clearbits_int(&p->p_flag, P_INKTR); } @@ -284,7 +284,7 @@ ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, len -= count; } - free(ktp, M_TEMP); + free(ktp, M_TEMP, 0); atomic_clearbits_int(&p->p_flag, P_INKTR); } @@ -346,7 +346,7 @@ ktrstruct(struct proc *p, const char *name, const void *data, size_t datalen) kth.ktr_len = buflen; ktrwrite(p, &kth, buf); - free(buf, M_TEMP); + free(buf, M_TEMP, 0); atomic_clearbits_int(&p->p_flag, P_INKTR); } @@ -387,7 +387,7 @@ ktruser(struct proc *p, const char *id, const void *addr, size_t len) ktrwrite(p, &kth, ktp); out: if (memp != NULL) - free(memp, M_TEMP); + free(memp, M_TEMP, 0); atomic_clearbits_int(&p->p_flag, P_INKTR); return (error); } diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c index e19a5f7a876..a7a736b03dc 100644 --- a/sys/kern/kern_lkm.c +++ b/sys/kern/kern_lkm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_lkm.c,v 1.47 2014/01/21 01:48:44 tedu Exp $ */ +/* $OpenBSD: kern_lkm.c,v 1.48 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_lkm.c,v 1.31 1996/03/31 21:40:27 christos Exp $ */ /* @@ -190,7 +190,7 @@ lkmfree(struct lkm_table *p) { TAILQ_REMOVE(&lkmods, p, list); - free(p, M_DEVBUF); + free(p, M_DEVBUF, 0); curp = NULL; } diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 83936778a0d..496775f6697 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.112 2014/07/10 22:16:48 tedu Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.113 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -354,7 +354,7 @@ out: * Free a block of memory allocated by malloc. */ void -free(void *addr, int type) +free(void *addr, int type, size_t fauxsize) { struct kmembuckets *kbp; struct kmemusage *kup; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index df2d4e38ecf..6a81f16b6c7 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.59 2014/07/04 05:58:30 guenther Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.60 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -124,7 +124,7 @@ uid_find(uid_t uid) if (uip->ui_uid == uid) break; if (uip) { - free(nuip, M_PROC); + free(nuip, M_PROC, 0); return (uip); } nuip->ui_uid = uid; diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c index 2c8a40ed136..18453d15025 100644 --- a/sys/kern/kern_sensors.c +++ b/sys/kern/kern_sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sensors.c,v 1.27 2013/12/09 17:39:08 mikeb Exp $ */ +/* $OpenBSD: kern_sensors.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2005 David Gwynne @@ -248,7 +248,7 @@ sensor_task_work(void *xst, void *arg) rw_exit_write(&st->lock); if (period == 0) - free(st, M_DEVBUF); + free(st, M_DEVBUF, 0); else timeout_add_sec(&st->timeout, period); } diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 2e3bacb3100..f0f216bc190 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_subr.c,v 1.37 2013/10/19 09:24:57 reyk Exp $ */ +/* $OpenBSD: kern_subr.c,v 1.38 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */ /* @@ -221,7 +221,7 @@ hook_disestablish(struct hook_desc_head *head, void *vhook) #endif hdp = vhook; TAILQ_REMOVE(head, hdp, hd_list); - free(hdp, M_DEVBUF); + free(hdp, M_DEVBUF, 0); } /* @@ -244,7 +244,7 @@ dohooks(struct hook_desc_head *head, int flags) TAILQ_REMOVE(head, hdp, hd_list); (*hdp->hd_fn)(hdp->hd_arg); if ((flags & HOOK_FREE) != 0) - free(hdp, M_DEVBUF); + free(hdp, M_DEVBUF, 0); } } } diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 3b3f3bc43a0..8c0310dd307 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.255 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.256 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1308,7 +1308,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep, error = EINVAL; break; } - free(kf, M_TEMP); + free(kf, M_TEMP, 0); if (!error) { if (where == NULL) @@ -1471,7 +1471,7 @@ again: } err: if (kproc) - free(kproc, M_TEMP); + free(kproc, M_TEMP, 0); return (error); } @@ -1752,7 +1752,7 @@ more: out: uvmspace_free(vm); - free(buf, M_TEMP); + free(buf, M_TEMP, 0); return (error); } @@ -1816,7 +1816,7 @@ sysctl_proc_cwd(int *name, u_int namelen, void *oldp, size_t *oldlenp, } vrele(vp); - free(path, M_TEMP); + free(path, M_TEMP, 0); return (error); } @@ -1849,9 +1849,9 @@ sysctl_diskinit(int update, struct proc *p) tlen++; if (disknames) - free(disknames, M_SYSCTL); + free(disknames, M_SYSCTL, 0); if (diskstats) - free(diskstats, M_SYSCTL); + free(diskstats, M_SYSCTL, 0); diskstats = NULL; disknames = NULL; diskstats = malloc(disk_count * sizeof(struct diskstats), @@ -2029,7 +2029,7 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep) } *sizep -= buflen; error = copyout(buf, where, *sizep); - free(buf, M_TEMP); + free(buf, M_TEMP, 0); /* If copyout succeeded, use return code set earlier. */ return (error ? error : ret); } @@ -2074,7 +2074,7 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp, ret = sysctl_rdstruct(oldp, oldlenp, newp, usd, sizeof(struct sensordev)); - free(usd, M_TEMP); + free(usd, M_TEMP, 0); return (ret); } @@ -2097,7 +2097,7 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp, ret = sysctl_rdstruct(oldp, oldlenp, newp, us, sizeof(struct sensor)); - free(us, M_TEMP); + free(us, M_TEMP, 0); return (ret); } diff --git a/sys/kern/kern_task.c b/sys/kern/kern_task.c index 04592ad7f4e..b685ce888e2 100644 --- a/sys/kern/kern_task.c +++ b/sys/kern/kern_task.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_task.c,v 1.9 2014/06/11 08:47:53 blambert Exp $ */ +/* $OpenBSD: kern_task.c,v 1.10 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2013 David Gwynne @@ -129,7 +129,7 @@ taskq_destroy(struct taskq *tq) } mtx_leave(&tq->tq_mtx); - free(tq, M_DEVBUF); + free(tq, M_DEVBUF, 0); } void @@ -143,7 +143,7 @@ taskq_create_thread(void *arg) switch (tq->tq_state) { case TQ_S_DESTROYED: mtx_leave(&tq->tq_mtx); - free(tq, M_DEVBUF); + free(tq, M_DEVBUF, 0); return; case TQ_S_CREATED: diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 516bc2326a2..2b3b09c748f 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_tc.c,v 1.24 2014/04/03 17:58:31 beck Exp $ */ +/* $OpenBSD: kern_tc.c,v 1.25 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2000 Poul-Henning Kamp @@ -541,7 +541,7 @@ sysctl_tc_choice(void *oldp, size_t *oldlenp, void *newp, size_t newlen) strlcat(choices, buf, maxlen); } error = sysctl_rdstring(oldp, oldlenp, newp, choices); - free(choices, M_TEMP); + free(choices, M_TEMP, 0); return (error); } diff --git a/sys/kern/kern_workq.c b/sys/kern/kern_workq.c index df3762b80d0..a019620ab1c 100644 --- a/sys/kern/kern_workq.c +++ b/sys/kern/kern_workq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_workq.c,v 1.14 2013/11/26 20:33:19 deraadt Exp $ */ +/* $OpenBSD: kern_workq.c,v 1.15 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -116,7 +116,7 @@ workq_destroy(struct workq *wq) } mtx_leave(&wq->wq_mtx); - free(wq, M_DEVBUF); + free(wq, M_DEVBUF, 0); } int @@ -164,7 +164,7 @@ workq_create_thread(void *arg) switch (wq->wq_state) { case WQ_S_DESTROYED: mtx_leave(&wq->wq_mtx); - free(wq, M_DEVBUF); + free(wq, M_DEVBUF, 0); return; case WQ_S_CREATED: diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index b4021a46b17..f0994287b46 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_autoconf.c,v 1.76 2014/07/12 13:43:08 mpi Exp $ */ +/* $OpenBSD: subr_autoconf.c,v 1.77 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */ /* @@ -152,12 +152,12 @@ mapply(struct matchinfo *m, struct cfdata *cf) if (pri > m->pri) { if (m->indirect && m->match) - free(m->match, M_DEVBUF); + free(m->match, M_DEVBUF, 0); m->match = match; m->pri = pri; } else { if (m->indirect) - free(match, M_DEVBUF); + free(match, M_DEVBUF, 0); } } @@ -468,7 +468,7 @@ config_make_softc(struct device *parent, struct cfdata *cf) old != 0 ? "expand" : "creat"); if (old != 0) { bcopy(cd->cd_devs, nsp, old * sizeof(void *)); - free(cd->cd_devs, M_DEVBUF); + free(cd->cd_devs, M_DEVBUF, 0); } cd->cd_devs = nsp; } @@ -610,7 +610,7 @@ config_detach(struct device *dev, int flags) if (cd->cd_devs[i] != NULL) break; if (i == cd->cd_ndevs) { /* nothing found; deallocate */ - free(cd->cd_devs, M_DEVBUF); + free(cd->cd_devs, M_DEVBUF, 0); cd->cd_devs = NULL; cd->cd_ndevs = 0; cf->cf_unit = 0; @@ -689,7 +689,7 @@ config_process_deferred_children(struct device *parent) if (dc->dc_dev->dv_parent == parent) { TAILQ_REMOVE(&deferred_config_queue, dc, dc_queue); (*dc->dc_func)(dc->dc_dev); - free(dc, M_DEVBUF); + free(dc, M_DEVBUF, 0); config_pending_decr(); } } @@ -888,6 +888,6 @@ device_unref(struct device *dv) { dv->dv_ref--; if (dv->dv_ref == 0) { - free(dv, M_DEVBUF); + free(dv, M_DEVBUF, 0); } } diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 5979a3ff4be..95fc03e0e91 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.166 2014/07/12 17:50:36 jsing Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.167 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -816,7 +816,7 @@ disk_detach(struct disk *diskp) /* * Free the space used by the disklabel structures. */ - free(diskp->dk_label, M_DEVBUF); + free(diskp->dk_label, M_DEVBUF, 0); /* * Remove from the disklist. diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index f5f29cb1cbd..52e130e891f 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.50 2014/01/21 21:45:58 kettenis Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.51 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -236,7 +236,7 @@ extent_create(char *name, u_long start, u_long end, int mtype, caddr_t storage, rp = extent_alloc_region_descriptor(ex, flags); if (rp == NULL) { if (!fixed_extent) - free(ex, mtype); + free(ex, mtype, 0); return (NULL); } rp->er_start = start; @@ -280,7 +280,7 @@ extent_destroy(struct extent *ex) /* If we're not a fixed extent, free the extent descriptor itself. */ if ((ex->ex_flags & EXF_FIXED) == 0) - free(ex, ex->ex_mtype); + free(ex, ex->ex_mtype, 0); } /* diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index a0b455d305c..b64872a82d8 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.20 2014/07/10 08:55:35 deraadt Exp $ */ +/* $OpenBSD: subr_log.c,v 1.21 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -380,7 +380,7 @@ sys_sendsyslog(struct proc *p, void *v, register_t *retval) if (ktriov != NULL) { if (error == 0) ktrgenio(p, 0, UIO_WRITE, ktriov, aiov.iov_len); - free(ktriov, M_TEMP); + free(ktriov, M_TEMP, 0); } #endif FRELE(f, p); diff --git a/sys/kern/subr_userconf.c b/sys/kern/subr_userconf.c index eeb530f4e12..1ff26b477da 100644 --- a/sys/kern/subr_userconf.c +++ b/sys/kern/subr_userconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_userconf.c,v 1.39 2014/01/21 01:48:44 tedu Exp $ */ +/* $OpenBSD: subr_userconf.c,v 1.40 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 1996-2001 Mats O Jansson @@ -510,7 +510,7 @@ userconf_change(int devno) if (memcmp(cd->cf_loc, lk, sizeof(int) * i)) cd->cf_loc = lk; else - free(lk, M_TEMP); + free(lk, M_TEMP, 0); } printf("%3d ", devno); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 837d95f8182..b94b7dd4f8f 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.88 2014/07/08 17:42:50 miod Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.89 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -212,13 +212,13 @@ dofilereadv(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, if (ktriov != NULL) { if (error == 0) ktrgenio(p, fd, UIO_READ, ktriov, cnt); - free(ktriov, M_TEMP); + free(ktriov, M_TEMP, 0); } #endif *retval = cnt; done: if (needfree) - free(needfree, M_IOV); + free(needfree, M_IOV, 0); out: FRELE(fp, p); return (error); @@ -368,13 +368,13 @@ dofilewritev(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, if (ktriov != NULL) { if (error == 0) ktrgenio(p, fd, UIO_WRITE, ktriov, cnt); - free(ktriov, M_TEMP); + free(ktriov, M_TEMP, 0); } #endif *retval = cnt; done: if (needfree) - free(needfree, M_IOV); + free(needfree, M_IOV, 0); out: FRELE(fp, p); return (error); @@ -518,7 +518,7 @@ sys_ioctl(struct proc *p, void *v, register_t *retval) out: FRELE(fp, p); if (memp) - free(memp, M_IOCTLOPS); + free(memp, M_IOCTLOPS, 0); return (error); } @@ -714,7 +714,7 @@ done: } if (pibits[0] != (fd_set *)&bits[0]) - free(pibits[0], M_TEMP); + free(pibits[0], M_TEMP, 0); return (error); } @@ -1015,7 +1015,7 @@ done: } bad: if (pl != pfds) - free(pl, M_TEMP); + free(pl, M_TEMP, 0); return (error); } diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 56cf0e0ea19..53d7efec5ad 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_process.c,v 1.62 2014/07/11 08:18:31 guenther Exp $ */ +/* $OpenBSD: sys_process.c,v 1.63 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */ /*- @@ -581,7 +581,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) { error = process_write_regs(t, regs); } - free(regs, M_TEMP); + free(regs, M_TEMP, 0); return (error); case PT_GETREGS: KASSERT((p->p_flag & P_SYSTEM) == 0); @@ -593,7 +593,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) error = copyout(regs, SCARG(uap, addr), sizeof (*regs)); - free(regs, M_TEMP); + free(regs, M_TEMP, 0); return (error); #ifdef PT_SETFPREGS case PT_SETFPREGS: @@ -606,7 +606,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) { error = process_write_fpregs(t, fpregs); } - free(fpregs, M_TEMP); + free(fpregs, M_TEMP, 0); return (error); #endif #ifdef PT_GETFPREGS @@ -620,7 +620,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) error = copyout(fpregs, SCARG(uap, addr), sizeof(*fpregs)); - free(fpregs, M_TEMP); + free(fpregs, M_TEMP, 0); return (error); #endif #ifdef PT_SETXMMREGS @@ -634,7 +634,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) { error = process_write_xmmregs(t, xmmregs); } - free(xmmregs, M_TEMP); + free(xmmregs, M_TEMP, 0); return (error); #endif #ifdef PT_GETXMMREGS @@ -648,7 +648,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval) if (error == 0) error = copyout(xmmregs, SCARG(uap, addr), sizeof(*xmmregs)); - free(xmmregs, M_TEMP); + free(xmmregs, M_TEMP, 0); return (error); #endif #ifdef PT_WCOOKIE diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 3c2ed063724..7a2760b7104 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_msg.c,v 1.27 2014/03/18 06:59:00 guenther Exp $ */ +/* $OpenBSD: sysv_msg.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */ /* * Copyright (c) 2009 Bret S. Lambert @@ -393,7 +393,7 @@ que_create(key_t key, struct ucred *cred, int mode) /* if malloc slept, a queue with the same key may have been created */ if (que_key_lookup(key)) { - free(que, M_TEMP); + free(que, M_TEMP, 0); return (NULL); } @@ -488,7 +488,7 @@ que_free(struct que *que) TAILQ_REMOVE(&que->que_msgs, msg, msg_next); msg_free(msg); } - free(que, M_TEMP); + free(que, M_TEMP, 0); num_ques--; } @@ -699,7 +699,7 @@ sysctl_sysvmsg(int *name, u_int namelen, void *where, size_t *sizep) msginfo.msgmni * sizeof(struct msqid_ds); if (*sizep < infolen) { - free(info, M_TEMP); + free(info, M_TEMP, 0); return (ENOMEM); } @@ -716,7 +716,7 @@ sysctl_sysvmsg(int *name, u_int namelen, void *where, size_t *sizep) error = copyout(info, where, infolen); - free(info, M_TEMP); + free(info, M_TEMP, 0); return (error); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index b5b8e1e515b..df3ddd3650a 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_sem.c,v 1.46 2014/03/18 06:59:00 guenther Exp $ */ +/* $OpenBSD: sysv_sem.c,v 1.47 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */ /* @@ -277,7 +277,7 @@ semctl1(struct proc *p, int semid, int semnum, int cmd, union semun *arg, semaptr->sem_perm.cuid = cred->cr_uid; semaptr->sem_perm.uid = cred->cr_uid; semtot -= semaptr->sem_nsems; - free(semaptr->sem_base, M_SEM); + free(semaptr->sem_base, M_SEM, 0); pool_put(&sema_pool, semaptr); sema[ix] = NULL; semundo_clear(ix, -1); @@ -384,7 +384,7 @@ semctl1(struct proc *p, int semid, int semnum, int cmd, union semun *arg, error: if (semval) - free(semval, M_TEMP); + free(semval, M_TEMP, 0); return (error); } @@ -446,7 +446,7 @@ sys_semget(struct proc *p, void *v, register_t *retval) goto error; } if (semaptr_new != NULL) { - free(semaptr_new->sem_base, M_SEM); + free(semaptr_new->sem_base, M_SEM, 0); pool_put(&sema_pool, semaptr_new); } goto found; @@ -489,7 +489,7 @@ found: return (0); error: if (semaptr_new != NULL) { - free(semaptr_new->sem_base, M_SEM); + free(semaptr_new->sem_base, M_SEM, 0); pool_put(&sema_pool, semaptr_new); } return (error); @@ -753,7 +753,7 @@ done: *retval = 0; done2: if (sops != sopbuf) - free(sops, M_SEM); + free(sops, M_SEM, 0); return (error); } @@ -881,8 +881,8 @@ sysctl_sysvsem(int *name, u_int namelen, void *oldp, size_t *oldlenp, M_WAITOK|M_ZERO); bcopy(semseqs, newseqs, seminfo.semmni * sizeof(unsigned short)); - free(sema, M_SEM); - free(semseqs, M_SEM); + free(sema, M_SEM, 0); + free(semseqs, M_SEM, 0); sema = sema_new; semseqs = newseqs; seminfo.semmni = val; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index f850629e9a0..c9ea3b5f3f7 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.56 2014/03/18 06:59:00 guenther Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.57 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -517,7 +517,7 @@ shmexit(struct vmspace *vm) i++, shmmap_s++) if (shmmap_s->shmid != -1) shm_delete_mapping(vm, shmmap_s); - free(vm->vm_shm, M_SHM); + free(vm->vm_shm, M_SHM, 0); vm->vm_shm = NULL; } @@ -596,13 +596,13 @@ sysctl_sysvshm(int *name, u_int namelen, void *oldp, size_t *oldlenp, M_SHM, M_WAITOK|M_ZERO); bcopy(shmsegs, newsegs, shminfo.shmmni * sizeof(struct shmid_ds *)); - free(shmsegs, M_SHM); + free(shmsegs, M_SHM, 0); shmsegs = newsegs; newseqs = malloc(val * sizeof(unsigned short), M_SHM, M_WAITOK|M_ZERO); bcopy(shmseqs, newseqs, shminfo.shmmni * sizeof(unsigned short)); - free(shmseqs, M_SHM); + free(shmseqs, M_SHM, 0); shmseqs = newseqs; shminfo.shmmni = val; return (0); diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b41e9bdcdda..2fb04ad11aa 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.110 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.111 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -1641,7 +1641,7 @@ read: out: if (stime) { timeout_del(stime); - free(stime, M_TEMP); + free(stime, M_TEMP, 0); } return (error); } @@ -2358,7 +2358,7 @@ ttyfree(struct tty *tp) clfree(&tp->t_rawq); clfree(&tp->t_canq); clfree(&tp->t_outq); - free(tp, M_TTYS); + free(tp, M_TTYS, 0); } void @@ -2416,7 +2416,7 @@ sysctl_tty(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, ttystats_init(&ttystats); err = sysctl_rdstruct(oldp, oldlenp, newp, ttystats, tty_count * sizeof(struct itty)); - free(ttystats, M_SYSCTL); + free(ttystats, M_SYSCTL, 0); return (err); } default: diff --git a/sys/kern/tty_endrun.c b/sys/kern/tty_endrun.c index 9cba2d53550..a7d35401961 100644 --- a/sys/kern/tty_endrun.c +++ b/sys/kern/tty_endrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_endrun.c,v 1.3 2010/04/12 12:57:52 tedu Exp $ */ +/* $OpenBSD: tty_endrun.c,v 1.4 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -155,7 +155,7 @@ endrunopen(dev_t dev, struct tty *tp, struct proc *p) error = linesw[TTYDISC].l_open(dev, tp, p); if (error) { - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; } else { sensordev_install(&np->timedev); @@ -174,7 +174,7 @@ endrunclose(struct tty *tp, int flags, struct proc *p) tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->endrun_tout); sensordev_deinstall(&np->timedev); - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; endrun_count--; if (endrun_count == 0) diff --git a/sys/kern/tty_msts.c b/sys/kern/tty_msts.c index 00b2566572c..e87c1971507 100644 --- a/sys/kern/tty_msts.c +++ b/sys/kern/tty_msts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_msts.c,v 1.16 2010/04/12 12:57:52 tedu Exp $ */ +/* $OpenBSD: tty_msts.c,v 1.17 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -117,7 +117,7 @@ mstsopen(dev_t dev, struct tty *tp, struct proc *p) error = linesw[TTYDISC].l_open(dev, tp, p); if (error) { - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; } else { sensordev_install(&np->timedev); @@ -135,7 +135,7 @@ mstsclose(struct tty *tp, int flags, struct proc *p) tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->msts_tout); sensordev_deinstall(&np->timedev); - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; msts_count--; if (msts_count == 0) diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 4b0c84926f8..9bf5c4ca05f 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.41 2014/03/21 21:54:14 andre Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.42 2014/07/12 18:43:32 tedu Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Marc Balmer @@ -135,7 +135,7 @@ nmeaopen(dev_t dev, struct tty *tp, struct proc *p) error = linesw[TTYDISC].l_open(dev, tp, p); if (error) { - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; } else { sensordev_install(&np->timedev); @@ -152,7 +152,7 @@ nmeaclose(struct tty *tp, int flags, struct proc *p) tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->nmea_tout); sensordev_deinstall(&np->timedev); - free(np, M_DEVBUF); + free(np, M_DEVBUF, 0); tp->t_sc = NULL; nmea_count--; if (nmea_count == 0) diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 94c10c0dc7b..cddbad83923 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.66 2014/07/09 15:46:22 tedu Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.67 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -182,7 +182,7 @@ check_pty(int minor) newpt = ptyarralloc(newnpty); memcpy(newpt, pt_softc, npty * sizeof(struct pt_softc *)); - free(pt_softc, M_DEVBUF); + free(pt_softc, M_DEVBUF, 0); pt_softc = newpt; npty = newnpty; } diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index aa8c39a6a3e..34e0329431b 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_subr.c,v 1.27 2014/07/09 15:46:22 tedu Exp $ */ +/* $OpenBSD: tty_subr.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */ /* @@ -73,11 +73,11 @@ clfree(struct clist *clp) { if (clp->c_cs) { explicit_bzero(clp->c_cs, clp->c_cn); - free(clp->c_cs, M_TTYS); + free(clp->c_cs, M_TTYS, 0); } if (clp->c_cq) { explicit_bzero(clp->c_cq, QMEM(clp->c_cn)); - free(clp->c_cq, M_TTYS); + free(clp->c_cq, M_TTYS, 0); } clp->c_cs = clp->c_cq = NULL; } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 5ff3bef35a1..147dcb789b9 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.89 2013/09/14 02:28:02 guenther Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.90 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -454,7 +454,7 @@ sys_sendmsg(struct proc *p, void *v, register_t *retval) error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval); done: if (iov != aiov) - free(iov, M_IOV); + free(iov, M_IOV, 0); return (error); } @@ -539,7 +539,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize) if (ktriov != NULL) { if (error == 0) ktrgenio(p, s, UIO_WRITE, ktriov, *retsize); - free(ktriov, M_TEMP); + free(ktriov, M_TEMP, 0); } #endif bad: @@ -619,7 +619,7 @@ sys_recvmsg(struct proc *p, void *v, register_t *retval) } done: if (iov != aiov) - free(iov, M_IOV); + free(iov, M_IOV, 0); return (error); } @@ -678,7 +678,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, if (ktriov != NULL) { if (error == 0) ktrgenio(p, s, UIO_READ, ktriov, len - auio.uio_resid); - free(ktriov, M_TEMP); + free(ktriov, M_TEMP, 0); } #endif if (error) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index cea89f690ca..a3f6e59a8b5 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_usrreq.c,v 1.73 2014/03/18 06:59:00 guenther Exp $ */ +/* $OpenBSD: uipc_usrreq.c,v 1.74 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */ /* @@ -394,10 +394,10 @@ unp_detach(struct unpcb *unp) * gets them (resulting in a "panic: closef: count < 0"). */ sorflush(unp->unp_socket); - free(unp, M_PCB); + free(unp, M_PCB, 0); unp_gc(); } else - free(unp, M_PCB); + free(unp, M_PCB, 0); } int @@ -636,7 +636,7 @@ unp_drop(struct unpcb *unp, int errno) so->so_pcb = NULL; sofree(so); m_freem(unp->unp_addr); - free(unp, M_PCB); + free(unp, M_PCB, 0); } } @@ -767,7 +767,7 @@ restart: out: fdpunlock(p->p_fd); if (fdp) - free(fdp, M_TEMP); + free(fdp, M_TEMP, 0); return (error); } @@ -810,14 +810,14 @@ morespace: /* allocate a cluster and try again */ MCLGET(control, M_WAIT); if ((control->m_flags & M_EXT) == 0) { - free(tmp, M_TEMP); + free(tmp, M_TEMP, 0); return (ENOBUFS); /* allocation failed */ } /* copy the data back into the cluster */ cm = mtod(control, struct cmsghdr *); memcpy(cm, tmp, control->m_len); - free(tmp, M_TEMP); + free(tmp, M_TEMP, 0); goto morespace; } @@ -980,7 +980,7 @@ unp_gc(void) sorflush((*fpp)->f_data); for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp) (void) closef(*fpp, NULL); - free(extra_ref, M_FILE); + free(extra_ref, M_FILE, 0); unp_gcing = 0; } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index bab53313460..16c1fc136ed 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.157 2014/07/11 03:06:08 mlarkin Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.158 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /* @@ -408,7 +408,7 @@ bread_cluster_callback(struct buf *bp) biodone(xbpp[i]); } - free(xbpp, M_TEMP); + free(xbpp, M_TEMP, 0); if (ISSET(bp->b_flags, B_ASYNC)) { brelse(bp); @@ -460,7 +460,7 @@ bread_cluster(struct vnode *vp, daddr_t blkno, int size, struct buf **rbpp) SET(xbpp[i]->b_flags, B_INVAL); brelse(xbpp[i]); } - free(xbpp, M_TEMP); + free(xbpp, M_TEMP, 0); goto out; } } diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index c78fd3b1ed0..89d84c67696 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_cluster.c,v 1.41 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: vfs_cluster.c,v 1.42 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_cluster.c,v 1.12 1996/04/22 01:39:05 christos Exp $ */ /* @@ -102,7 +102,7 @@ cluster_write(struct buf *bp, struct cluster_info *ci, u_quad_t filesize) for (bpp = buflist->bs_children; bpp < endbp; bpp++) brelse(*bpp); - free(buflist, M_VCLUSTER); + free(buflist, M_VCLUSTER, 0); cluster_wbuild(vp, NULL, bp->b_bcount, ci->ci_cstart, cursize, lbn); } else { @@ -112,7 +112,7 @@ cluster_write(struct buf *bp, struct cluster_info *ci, u_quad_t filesize) for (bpp = buflist->bs_children; bpp <= endbp; bpp++) bdwrite(*bpp); - free(buflist, M_VCLUSTER); + free(buflist, M_VCLUSTER, 0); ci->ci_lastw = lbn; ci->ci_lasta = bp->b_blkno; return; diff --git a/sys/kern/vfs_getcwd.c b/sys/kern/vfs_getcwd.c index 93231074fe2..8421c4689be 100644 --- a/sys/kern/vfs_getcwd.c +++ b/sys/kern/vfs_getcwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_getcwd.c,v 1.21 2013/08/13 05:52:24 guenther Exp $ */ +/* $OpenBSD: vfs_getcwd.c,v 1.22 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ /* @@ -192,7 +192,7 @@ out: vrele(lvp); *lvpp = NULL; - free(dirbuf, M_TEMP); + free(dirbuf, M_TEMP, 0); return (error); } @@ -420,7 +420,7 @@ sys___getcwd(struct proc *p, void *v, register_t *retval) error = copyout(bp, SCARG(uap, buf), lenused); out: - free(path, M_TEMP); + free(path, M_TEMP, 0); return (error); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 120ca5bec3c..b97b497f821 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.216 2014/07/10 12:21:08 mpi Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.217 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1066,7 +1066,7 @@ vgonel(struct vnode *vp, struct proc *p) vx->v_flag &= ~VALIASED; vp->v_flag &= ~VALIASED; } - free(vp->v_specinfo, M_VNODE); + free(vp->v_specinfo, M_VNODE, 0); vp->v_specinfo = NULL; } /* @@ -1281,7 +1281,7 @@ vfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, ret = sysctl_rdstruct(oldp, oldlenp, newp, tmpvfsp, sizeof(struct vfsconf)); - free(tmpvfsp, M_TEMP); + free(tmpvfsp, M_TEMP, 0); return (ret); case VFS_BCACHESTAT: /* buffer cache statistics */ ret = sysctl_rdstruct(oldp, oldlenp, newp, &bcstats, @@ -1449,7 +1449,7 @@ finish: crfromxucred(&np->netc_anon, &argp->ex_anon); return (0); out: - free(np, M_NETADDR); + free(np, M_NETADDR, 0); return (error); } @@ -1460,7 +1460,7 @@ vfs_free_netcred(struct radix_node *rn, void *w, u_int id) struct radix_node_head *rnh = (struct radix_node_head *)w; (*rnh->rnh_deladdr)(rn->rn_key, rn->rn_mask, rnh, NULL); - free(rn, M_NETADDR); + free(rn, M_NETADDR, 0); return (0); } @@ -1474,7 +1474,7 @@ vfs_free_addrlist(struct netexport *nep) if ((rnh = nep->ne_rtable_inet) != NULL) { (*rnh->rnh_walktree)(rnh, vfs_free_netcred, rnh); - free(rnh, M_RTABLE); + free(rnh, M_RTABLE, 0); nep->ne_rtable_inet = NULL; } } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 7fb1adebd27..11d1afba894 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.207 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.208 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -304,7 +304,7 @@ update: } else { mp->mnt_vnodecovered->v_mountedhere = NULL; vfs_unbusy(mp); - free(mp, M_MOUNT); + free(mp, M_MOUNT, 0); vput(vp); } return (error); @@ -454,7 +454,7 @@ dounmount(struct mount *mp, int flags, struct proc *p, struct vnode *olddp) panic("unmount: dangling vnode"); vfs_unbusy(mp); - free(mp, M_MOUNT); + free(mp, M_MOUNT, 0); return (0); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 8971904785a..0ea3035563a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.76 2014/07/08 17:19:25 deraadt Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.77 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -173,7 +173,7 @@ vn_open(struct nameidata *ndp, int fmode, int cmode) VOP_UNLOCK(vp, 0, p); /* keep a reference */ vp = ndp->ni_vp; /* for the increment below */ - free(cip, M_TEMP); + free(cip, M_TEMP, 0); } if (fmode & FWRITE) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 58bf24cac5f..6943a86c773 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.h,v 1.110 2014/07/12 10:51:35 tedu Exp $ */ +/* $OpenBSD: malloc.h,v 1.111 2014/07/12 18:43:32 tedu Exp $ */ /* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */ /* @@ -393,7 +393,7 @@ extern struct kmembuckets bucket[]; void *malloc(size_t, int, int); void *mallocarray(size_t, size_t, int, int); -void free(void *, int); +void free(void *, int, size_t); int sysctl_malloc(int *, u_int, void *, size_t *, void *, size_t, struct proc *); -- 2.20.1