summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-08 10:21:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-08 10:21:51 +0000
commitc3b32008dd21a7dbcb3320913bb597c6a15e35a5 (patch)
treed4b6c80b156051624e16fc1094e9bf96ab17ffc5
parent59ef1900870bbf991c1371b2a82f8d62061e2356 (diff)
sizes for free(); ok semarie
-rw-r--r--sys/arch/sgi/dev/impact.c4
-rw-r--r--sys/arch/sgi/dev/spdmem_mainbus.c6
-rw-r--r--sys/arch/sgi/gio/grtwo.c6
-rw-r--r--sys/arch/sgi/gio/newport.c4
-rw-r--r--sys/arch/sgi/sgi/eisa_machdep.c4
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c4
-rw-r--r--sys/arch/sgi/sgi/l1.c8
-rw-r--r--sys/arch/sgi/xbow/xbridge.c6
-rw-r--r--sys/arch/sgi/xbow/xheart.c4
-rw-r--r--sys/arch/sparc/dev/cs4231.c6
-rw-r--r--sys/arch/sparc/dev/fd.c6
-rw-r--r--sys/arch/sparc/sparc/intr.c4
-rw-r--r--sys/arch/sparc/sparc/machdep.c4
-rw-r--r--sys/arch/sparc/sparc/vm_machdep.c4
14 files changed, 35 insertions, 35 deletions
diff --git a/sys/arch/sgi/dev/impact.c b/sys/arch/sgi/dev/impact.c
index dc5481fcbb9..dd589faa3bc 100644
--- a/sys/arch/sgi/dev/impact.c
+++ b/sys/arch/sgi/dev/impact.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: impact.c,v 1.7 2014/12/13 21:05:32 doug Exp $ */
+/* $OpenBSD: impact.c,v 1.8 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2010, 2012 Miodrag Vallat.
@@ -168,7 +168,7 @@ impact_attach_common(struct impact_softc *sc, bus_space_tag_t iot,
impact_setup(scr, has_hq4);
if (impact_init_screen(scr) != 0) {
printf("failed to allocate memory\n");
- free(scr, M_DEVBUF, 0);
+ free(scr, M_DEVBUF, sizeof *scr);
return ENOMEM;
}
}
diff --git a/sys/arch/sgi/dev/spdmem_mainbus.c b/sys/arch/sgi/dev/spdmem_mainbus.c
index 8b6de372241..3d37c202e87 100644
--- a/sys/arch/sgi/dev/spdmem_mainbus.c
+++ b/sys/arch/sgi/dev/spdmem_mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spdmem_mainbus.c,v 1.2 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: spdmem_mainbus.c,v 1.3 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -66,7 +66,7 @@ spdmem_mainbus_match(struct device *parent, void *vcf, void *aux)
rc = l1_get_brick_spd_record(saa->maa.maa_nasid, saa->dimm,
&spd, &spdlen);
if (rc == 0) {
- free(spd, M_DEVBUF, 0);
+ free(spd, M_DEVBUF, spdlen);
return 1;
} else
return 0;
@@ -91,8 +91,8 @@ spdmem_mainbus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_base.sc_read = spdmem_mainbus_read;
spdmem_attach_common(&sc->sc_base);
/* free record, as it won't be accessed anymore */
+ free(sc->sc_spd, M_DEVBUF, sc->sc_spdlen);
sc->sc_spdlen = 0;
- free(sc->sc_spd, M_DEVBUF, 0);
}
uint8_t
diff --git a/sys/arch/sgi/gio/grtwo.c b/sys/arch/sgi/gio/grtwo.c
index fd42e7eb2cb..85858afef19 100644
--- a/sys/arch/sgi/gio/grtwo.c
+++ b/sys/arch/sgi/gio/grtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grtwo.c,v 1.11 2014/12/09 06:58:29 doug Exp $ */
+/* $OpenBSD: grtwo.c,v 1.12 2015/09/08 10:21:50 deraadt Exp $ */
/* $NetBSD: grtwo.c,v 1.11 2009/11/22 19:09:15 mbalmer Exp $ */
/*
@@ -411,11 +411,11 @@ grtwo_attach(struct device *parent, struct device *self, void *aux)
goto out;
if (grtwo_attach_common(dc, ga) != 0) {
printf("\n%s: not responding\n", self->dv_xname);
- free(dc, M_DEVBUF, 0);
+ free(dc, M_DEVBUF, sizeof *dc);
return;
}
if (grtwo_init_screen(dc, M_WAITOK | M_CANFAIL) != 0) {
- free(dc, M_DEVBUF, 0);
+ free(dc, M_DEVBUF, sizeof *dc);
goto out;
}
#endif
diff --git a/sys/arch/sgi/gio/newport.c b/sys/arch/sgi/gio/newport.c
index 4e9b5504f3a..36065662f03 100644
--- a/sys/arch/sgi/gio/newport.c
+++ b/sys/arch/sgi/gio/newport.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newport.c,v 1.9 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: newport.c,v 1.10 2015/09/08 10:21:50 deraadt Exp $ */
/* $NetBSD: newport.c,v 1.15 2009/05/12 23:51:25 macallan Exp $ */
/*
@@ -554,7 +554,7 @@ newport_attach(struct device *parent, struct device *self, void *aux)
if (fail) {
printf("%s: failed to initialize screen\n", self->dv_xname);
- free(dc, M_DEVBUF, 0);
+ free(dc, M_DEVBUF, sizeof *dc);
return;
}
diff --git a/sys/arch/sgi/sgi/eisa_machdep.c b/sys/arch/sgi/sgi/eisa_machdep.c
index 01ede04030d..0a99007e3a9 100644
--- a/sys/arch/sgi/sgi/eisa_machdep.c
+++ b/sys/arch/sgi/sgi/eisa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eisa_machdep.c,v 1.3 2014/07/12 18:44:42 tedu Exp $ */
+/* $OpenBSD: eisa_machdep.c,v 1.4 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2012 Miodrag Vallat.
@@ -183,7 +183,7 @@ eisa_intr_disestablish(eisa_chipset_tag_t ec, void *cookie)
}
evcount_detach(&eih->ei_evcnt);
- free(eih, M_DEVBUF, 0);
+ free(eih, M_DEVBUF, sizeof *eih);
}
int
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index 157d5ba5dd4..ef8d320faac 100644
--- a/sys/arch/sgi/sgi/ip27_machdep.c
+++ b/sys/arch/sgi/sgi/ip27_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27_machdep.c,v 1.65 2014/11/25 19:08:42 miod Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.66 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -786,7 +786,7 @@ ip27_hub_intr_disestablish(int intrbit)
splx(s);
if (ISSET(ih->ih_flags, IH_ALLOCATED))
- free(ih, M_DEVBUF, 0);
+ free(ih, M_DEVBUF, sizeof *ih);
}
void
diff --git a/sys/arch/sgi/sgi/l1.c b/sys/arch/sgi/sgi/l1.c
index b566fe586c5..8c46a70109f 100644
--- a/sys/arch/sgi/sgi/l1.c
+++ b/sys/arch/sgi/sgi/l1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l1.c,v 1.9 2014/11/25 19:08:42 miod Exp $ */
+/* $OpenBSD: l1.c,v 1.10 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -771,7 +771,7 @@ l1_read_board_ia(int16_t nasid, int type, u_char **ria, size_t *rialen)
fail:
if (ia != NULL)
- free(ia, M_DEVBUF, 0);
+ free(ia, M_DEVBUF, ialen);
return rc;
}
@@ -914,7 +914,7 @@ l1_get_brick_ethernet_address(int16_t nasid, uint8_t *enaddr)
enaddr_aton(hexaddr, enaddr);
out:
- free(ia, M_DEVBUF, 0);
+ free(ia, M_DEVBUF, ialen);
return rc;
}
@@ -1188,7 +1188,7 @@ l1_get_brick_spd_record(int16_t nasid, int dimm, u_char **rspd, size_t *rspdlen)
fail:
if (spd != NULL)
- free(spd, M_DEVBUF, 0);
+ free(spd, M_DEVBUF, spdlen);
return rc;
}
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index ddeec0660d9..bf9eca4b62b 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.96 2015/06/24 16:52:52 miod Exp $ */
+/* $OpenBSD: xbridge.c,v 1.97 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2008, 2009, 2011 Miodrag Vallat.
@@ -1331,7 +1331,7 @@ xbridge_intr_establish(void *cookie, pci_intr_handle_t ih, int level,
LIST_INIT(&xi->xi_handlers);
if (xbow_intr_register(xb->xb_widget, level, &intrsrc) != 0) {
- free(xi, M_DEVBUF, 0);
+ free(xi, M_DEVBUF, sizeof *xi);
return NULL;
}
@@ -1439,7 +1439,7 @@ xbridge_intr_disestablish(void *cookie, void *vih)
*/
}
- free(xih, M_DEVBUF, 0);
+ free(xih, M_DEVBUF, sizeof *xih);
}
int
diff --git a/sys/arch/sgi/xbow/xheart.c b/sys/arch/sgi/xbow/xheart.c
index 19d56516461..b8aa0bf2378 100644
--- a/sys/arch/sgi/xbow/xheart.c
+++ b/sys/arch/sgi/xbow/xheart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xheart.c,v 1.27 2014/09/30 06:51:58 jmatthew Exp $ */
+/* $OpenBSD: xheart.c,v 1.28 2015/09/08 10:21:50 deraadt Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -374,7 +374,7 @@ xheart_intr_disestablish(int intrbit)
splx(s);
if (ISSET(ih->ih_flags, IH_ALLOCATED))
- free(ih, M_DEVBUF, 0);
+ free(ih, M_DEVBUF, sizeof *ih);
}
void
diff --git a/sys/arch/sparc/dev/cs4231.c b/sys/arch/sparc/dev/cs4231.c
index 097ac404cba..0c02ff2e54d 100644
--- a/sys/arch/sparc/dev/cs4231.c
+++ b/sys/arch/sparc/dev/cs4231.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4231.c,v 1.34 2015/05/11 06:52:36 ratchov Exp $ */
+/* $OpenBSD: cs4231.c,v 1.35 2015/09/08 10:21:16 deraadt Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -1396,7 +1396,7 @@ cs4231_alloc(addr, direction, size, pool, flags)
p->addr_dva = dvma_malloc(size, &p->addr, flags);
if (p->addr_dva == NULL) {
- free(p, pool, 0);
+ free(p, pool, sizeof *p);
return (NULL);
}
@@ -1420,7 +1420,7 @@ cs4231_free(addr, ptr, pool)
continue;
dvma_free(p->addr_dva, p->size, &p->addr);
*pp = p->next;
- free(p, pool, 0);
+ free(p, pool, sizeof *p);
return;
}
printf("%s: attempt to free rogue pointer\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index f47931cb127..d85d96783d7 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.90 2014/07/12 18:44:43 tedu Exp $ */
+/* $OpenBSD: fd.c,v 1.91 2015/09/08 10:21:16 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -1766,7 +1766,7 @@ fdioctl(dev, cmd, addr, flag, p)
lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
fdgetdisklabel(dev, fd, lp, 0);
bcopy(lp, fd->sc_dk.dk_label, sizeof(*lp));
- free(lp, M_TEMP, 0);
+ free(lp, M_TEMP, sizeof *lp);
return 0;
case DIOCGPDINFO:
@@ -1938,7 +1938,7 @@ fdformat(dev, finfo, p)
/* ...and wait for it to complete */
rv = biowait(bp);
- free(bp, M_TEMP, 0);
+ free(bp, M_TEMP, sizeof *bp);
return (rv);
}
diff --git a/sys/arch/sparc/sparc/intr.c b/sys/arch/sparc/sparc/intr.c
index de042ed21c8..06ebed3ae83 100644
--- a/sys/arch/sparc/sparc/intr.c
+++ b/sys/arch/sparc/sparc/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.40 2014/11/22 22:48:38 miod Exp $ */
+/* $OpenBSD: intr.c,v 1.41 2015/09/08 10:21:16 deraadt Exp $ */
/* $NetBSD: intr.c,v 1.20 1997/07/29 09:42:03 fair Exp $ */
/*
@@ -419,7 +419,7 @@ softintr_disestablish(void *arg)
struct sintrhand *sih = (struct sintrhand *)arg;
ih_remove(&sintrhand[sih->sih_ipl], &sih->sih_ih);
- free(sih, M_DEVBUF, 0);
+ free(sih, M_DEVBUF, sizeof *sih);
}
void *
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index af4e4b762df..ae26a175dcf 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.172 2015/06/02 04:31:53 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.173 2015/09/08 10:21:16 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -266,7 +266,7 @@ setregs(p, pack, stack, retval)
savefpstate(fs);
cpuinfo.fpproc = NULL;
}
- free((void *)fs, M_SUBPROC, 0);
+ free(fs, M_SUBPROC, sizeof *fs);
p->p_md.md_fpstate = NULL;
}
bzero((caddr_t)tf, sizeof *tf);
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c
index e70d8c01878..73395e50b38 100644
--- a/sys/arch/sparc/sparc/vm_machdep.c
+++ b/sys/arch/sparc/sparc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.60 2015/05/05 02:13:47 guenther Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.61 2015/09/08 10:21:16 deraadt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
@@ -278,7 +278,7 @@ cpu_exit(p)
savefpstate(fs);
cpuinfo.fpproc = NULL;
}
- free((void *)fs, M_SUBPROC, 0);
+ free(fs, M_SUBPROC, sizeof *fs);
}
pmap_deactivate(p);