diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-09-08 07:12:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-09-08 07:12:57 +0000 |
commit | 1c30b867b79adbab6af0c4f0dd0f7f22962018e4 (patch) | |
tree | fb73885ea0c6e5dee2ccef3fc445962ffa063f7b /sys | |
parent | 16414ff834b8904432e33c05c8a65a2fa7c5a44a (diff) |
sizes for free(); ok semarie
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/esm.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/i386/est.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/ioapic.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/k1x-pstate.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/powernow-k7.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/powernow-k8.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/sys_machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/via.c | 14 |
9 files changed, 32 insertions, 32 deletions
diff --git a/sys/arch/i386/i386/esm.c b/sys/arch/i386/i386/esm.c index a47b821ee39..975ffc59741 100644 --- a/sys/arch/i386/i386/esm.c +++ b/sys/arch/i386/i386/esm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esm.c,v 1.58 2015/09/08 04:28:34 semarie Exp $ */ +/* $OpenBSD: esm.c,v 1.59 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -888,7 +888,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap, s = mallocarray(nsensors, sizeof(struct ksensor), M_DEVBUF, M_NOWAIT|M_ZERO); if (s == NULL) { - free(es, M_DEVBUF, 0); + free(es, M_DEVBUF, sizeof(*es)); return; } @@ -906,7 +906,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap, s = mallocarray(nsensors, sizeof(struct ksensor), M_DEVBUF, M_NOWAIT|M_ZERO); if (s == NULL) { - free(es, M_DEVBUF, 0); + free(es, M_DEVBUF, sizeof(*es)); return; } @@ -922,7 +922,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap, case ESM_S_VOLTS: case ESM_S_VOLTSx10: if (esm_thresholds(sc, devmap, es) != 0) { - free(es, M_DEVBUF, 0); + free(es, M_DEVBUF, sizeof(*es)); continue; } /* FALLTHROUGH */ @@ -932,7 +932,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap, s = malloc(sizeof(struct ksensor), M_DEVBUF, M_NOWAIT|M_ZERO); if (s == NULL) { - free(es, M_DEVBUF, 0); + free(es, M_DEVBUF, sizeof(*es)); return; } diff --git a/sys/arch/i386/i386/est.c b/sys/arch/i386/i386/est.c index d45230efe35..74c51a3dc7c 100644 --- a/sys/arch/i386/i386/est.c +++ b/sys/arch/i386/i386/est.c @@ -1,4 +1,4 @@ -/* $OpenBSD: est.c,v 1.46 2015/09/08 04:28:34 semarie Exp $ */ +/* $OpenBSD: est.c,v 1.47 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 2003 Michael Eriksson. * All rights reserved. @@ -997,7 +997,7 @@ est_acpi_init() return acpilist; notable: - free(acpilist, M_DEVBUF, 0); + free(acpilist, M_DEVBUF, sizeof(*acpilist)); acpilist = NULL; nolist: return NULL; @@ -1025,7 +1025,7 @@ est_acpi_pss_changed(struct acpicpu_pss *pss, int npss) M_DEVBUF, M_NOWAIT)) == NULL) { printf("est_acpi_pss_changed: cannot allocate memory for new " "operating points"); - free(acpilist, M_DEVBUF, 0); + free(acpilist, M_DEVBUF, sizeof(*acpilist)); return; } @@ -1037,7 +1037,7 @@ est_acpi_pss_changed(struct acpicpu_pss *pss, int npss) } free(est_fqlist->table, M_DEVBUF, 0); - free(est_fqlist, M_DEVBUF, 0); + free(est_fqlist, M_DEVBUF, sizeof *est_fqlist); est_fqlist = acpilist; if (needtran) { diff --git a/sys/arch/i386/i386/ioapic.c b/sys/arch/i386/i386/ioapic.c index 2d7226e5d4a..1d12a8fb993 100644 --- a/sys/arch/i386/i386/ioapic.c +++ b/sys/arch/i386/i386/ioapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioapic.c,v 1.36 2015/07/13 17:45:01 mikeb Exp $ */ +/* $OpenBSD: ioapic.c,v 1.37 2015/09/08 07:12:56 deraadt Exp $ */ /* $NetBSD: ioapic.c,v 1.7 2003/07/14 22:32:40 lukem Exp $ */ /*- @@ -706,7 +706,7 @@ apic_intr_establish(int irq, int type, int level, int (*ih_fun)(void *), /*printf("%s: intr_establish: can't share %s with %s, irq %d\n", ih_what, isa_intr_typename(pin->ip_type), isa_intr_typename(type), intr);*/ - free(ih, M_DEVBUF, 0); + free(ih, M_DEVBUF, sizeof(*ih)); return (NULL); } break; @@ -822,7 +822,7 @@ apic_intr_disestablish(void *arg) apic_vectorset(sc, intr, minlevel, maxlevel); evcount_detach(&ih->ih_count); - free(ih, M_DEVBUF, 0); + free(ih, M_DEVBUF, sizeof(*ih)); } void diff --git a/sys/arch/i386/i386/k1x-pstate.c b/sys/arch/i386/i386/k1x-pstate.c index f50618a7ee5..213adbf9873 100644 --- a/sys/arch/i386/i386/k1x-pstate.c +++ b/sys/arch/i386/i386/k1x-pstate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: k1x-pstate.c,v 1.7 2014/09/14 14:17:23 jsg Exp $ */ +/* $OpenBSD: k1x-pstate.c,v 1.8 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 2011 Bryan Steele <brynet@gmail.com> * @@ -199,5 +199,5 @@ k1x_init(struct cpu_info *ci) setperf_prio = 1; return; } - free(cstate, M_DEVBUF, 0); + free(cstate, M_DEVBUF, sizeof(*cstate)); } diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 736c8b52d7f..0cd086e0c97 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.46 2015/09/08 04:28:34 semarie Exp $ */ +/* $OpenBSD: mem.c,v 1.47 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -300,7 +300,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) if (!error) error = copyout(md, mo->mo_desc, nd * sizeof(struct mem_range_desc)); - free(md, M_MEMDESC, 0); + free(md, M_MEMDESC, nd * sizeof(struct mem_range_desc)); } else { nd = mem_range_softc.mr_ndesc; } @@ -314,7 +314,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) md->mr_owner[sizeof(md->mr_owner) - 1] = 0; if (error == 0) error = mem_range_attr_set(md, &mo->mo_arg[0]); - free(md, M_MEMDESC, 0); + free(md, M_MEMDESC, sizeof(struct mem_range_desc)); break; } return (error); diff --git a/sys/arch/i386/i386/powernow-k7.c b/sys/arch/i386/i386/powernow-k7.c index 8e6c6b1d270..ff230f4d811 100644 --- a/sys/arch/i386/i386/powernow-k7.c +++ b/sys/arch/i386/i386/powernow-k7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: powernow-k7.c,v 1.36 2014/09/14 14:17:23 jsg Exp $ */ +/* $OpenBSD: powernow-k7.c,v 1.37 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 2004 Martin Végiard. @@ -447,5 +447,5 @@ k7_powernow_init(void) setperf_prio = 1; return; } - free(cstate, M_DEVBUF, 0); + free(cstate, M_DEVBUF, sizeof(*cstate)); } diff --git a/sys/arch/i386/i386/powernow-k8.c b/sys/arch/i386/i386/powernow-k8.c index 5e6008d6482..7354507973c 100644 --- a/sys/arch/i386/i386/powernow-k8.c +++ b/sys/arch/i386/i386/powernow-k8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: powernow-k8.c,v 1.28 2014/09/14 14:17:23 jsg Exp $ */ +/* $OpenBSD: powernow-k8.c,v 1.29 2015/09/08 07:12:56 deraadt Exp $ */ /* * Copyright (c) 2004 Martin Végiard. @@ -511,5 +511,5 @@ k8_powernow_init(void) setperf_prio = 1; return; } - free(cstate, M_DEVBUF, 0); + free(cstate, M_DEVBUF, sizeof(*cstate)); } diff --git a/sys/arch/i386/i386/sys_machdep.c b/sys/arch/i386/i386/sys_machdep.c index 105dca08ca3..bf509e25eec 100644 --- a/sys/arch/i386/i386/sys_machdep.c +++ b/sys/arch/i386/i386/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.34 2014/12/09 06:58:28 doug Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.35 2015/09/08 07:12:56 deraadt Exp $ */ /* $NetBSD: sys_machdep.c,v 1.28 1996/05/03 19:42:29 christos Exp $ */ /*- @@ -123,7 +123,7 @@ i386_get_ldt(struct proc *p, void *args, register_t *retval) } if (ua.start > nldt) { - free(cp, M_TEMP, 0); + free(cp, M_TEMP, ua.num * sizeof(union descriptor)); return (EINVAL); } @@ -143,7 +143,7 @@ i386_get_ldt(struct proc *p, void *args, register_t *retval) if (error == 0) *retval = num; - free(cp, M_TEMP, 0); + free(cp, M_TEMP, ua.num * sizeof(union descriptor)); return (error); } @@ -310,7 +310,7 @@ copy: *retval = ua.start; out: - free(descv, M_TEMP, 0); + free(descv, M_TEMP, ua.num * sizeof(*descv)); return (error); } #endif /* USER_LDT */ diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c index 06ddef156d4..3e007c4ba80 100644 --- a/sys/arch/i386/i386/via.c +++ b/sys/arch/i386/i386/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.34 2014/12/09 06:58:28 doug Exp $ */ +/* $OpenBSD: via.c,v 1.35 2015/09/08 07:12:56 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -119,7 +119,7 @@ viac3_crypto_setup(void) vc3_sc->sc_cid = crypto_get_driverid(0); if (vc3_sc->sc_cid < 0) { - free(vc3_sc, M_DEVBUF, 0); + free(vc3_sc, M_DEVBUF, sizeof(*vc3_sc)); return; /* YYY bitch? */ } @@ -163,7 +163,7 @@ viac3_crypto_newsession(u_int32_t *sidp, struct cryptoini *cri) return (ENOMEM); bcopy(sc->sc_sessions, ses, sesn * sizeof(*ses)); explicit_bzero(sc->sc_sessions, sesn * sizeof(*ses)); - free(sc->sc_sessions, M_DEVBUF, 0); + free(sc->sc_sessions, M_DEVBUF, sesn * sizeof(*ses)); sc->sc_sessions = ses; ses = &sc->sc_sessions[sesn]; sc->sc_nsessions++; @@ -303,13 +303,13 @@ viac3_crypto_freesession(u_int64_t tid) if (swd->sw_ictx) { explicit_bzero(swd->sw_ictx, axf->ctxsize); - free(swd->sw_ictx, M_CRYPTO_DATA, 0); + free(swd->sw_ictx, M_CRYPTO_DATA, axf->ctxsize); } if (swd->sw_octx) { explicit_bzero(swd->sw_octx, axf->ctxsize); - free(swd->sw_octx, M_CRYPTO_DATA, 0); + free(swd->sw_octx, M_CRYPTO_DATA, axf->ctxsize); } - free(swd, M_CRYPTO_DATA, 0); + free(swd, M_CRYPTO_DATA, sizeof(*swd)); } explicit_bzero(&sc->sc_sessions[sesn], sizeof(sc->sc_sessions[sesn])); @@ -430,7 +430,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd, if (sc->op_buf != NULL) { explicit_bzero(sc->op_buf, crd->crd_len); - free(sc->op_buf, M_DEVBUF, 0); + free(sc->op_buf, M_DEVBUF, crd->crd_len); sc->op_buf = NULL; } |