diff options
author | 2015-09-09 18:24:26 +0000 | |
---|---|---|
committer | 2015-09-09 18:24:26 +0000 | |
commit | 8b3b45c31672999f4f4517550483868dfab1e3b9 (patch) | |
tree | 33f12b80c11245e2822a2f2d114c8806aeddb9dc | |
parent | sizes for free(); ok sthen (diff) | |
download | wireguard-openbsd-8b3b45c31672999f4f4517550483868dfab1e3b9.tar.xz wireguard-openbsd-8b3b45c31672999f4f4517550483868dfab1e3b9.zip |
sizes for free(); ok semarie
-rw-r--r-- | sys/dev/ic/sili.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/siop.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/ti.c | 10 |
3 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index a7e756bfed4..4930fc28874 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili.c,v 1.56 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: sili.c,v 1.57 2015/09/09 18:24:26 deraadt Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -767,7 +767,7 @@ sili_ports_alloc(struct sili_softc *sc) freeports: /* bus_space(9) says subregions dont have to be freed */ - free(sp, M_DEVBUF, 0); + free(sp, M_DEVBUF, sc->sc_nports * sizeof(struct sili_port)); sc->sc_ports = NULL; return (1); } @@ -786,7 +786,7 @@ sili_ports_free(struct sili_softc *sc) } /* bus_space(9) says subregions dont have to be freed */ - free(sc->sc_ports, M_DEVBUF, 0); + free(sc->sc_ports, M_DEVBUF, sc->sc_nports * sizeof(struct sili_port)); sc->sc_ports = NULL; } @@ -938,7 +938,7 @@ free: destroy: bus_dmamap_destroy(sc->sc_dmat, sdm->sdm_map); sdmfree: - free(sdm, M_DEVBUF, 0); + free(sdm, M_DEVBUF, sizeof *sdm); return (NULL); } @@ -950,7 +950,7 @@ sili_dmamem_free(struct sili_softc *sc, struct sili_dmamem *sdm) bus_dmamem_unmap(sc->sc_dmat, sdm->sdm_kva, sdm->sdm_size); bus_dmamem_free(sc->sc_dmat, &sdm->sdm_seg, 1); bus_dmamap_destroy(sc->sc_dmat, sdm->sdm_map); - free(sdm, M_DEVBUF, 0); + free(sdm, M_DEVBUF, sizeof *sdm); } u_int32_t diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index bf8af6351f3..b7dbbd41802 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siop.c,v 1.70 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: siop.c,v 1.71 2015/09/09 18:24:26 deraadt Exp $ */ /* $NetBSD: siop.c,v 1.79 2005/11/18 23:10:32 bouyer Exp $ */ /* @@ -1425,7 +1425,7 @@ siop_scsiprobe(struct scsi_link *link) if (siop_target->lunsw == NULL) { printf("%s: can't alloc lunsw for target %d\n", sc->sc_c.sc_dev.dv_xname, target); - free(siop_target, M_DEVBUF, 0); + free(siop_target, M_DEVBUF, sizeof *siop_target); return (ENOMEM); } for (i = 0; i < 8; i++) @@ -1763,7 +1763,6 @@ end: bus_space_write_1(sc->sc_c.sc_rt, sc->sc_c.sc_rh, SIOP_ISTAT, ISTAT_SIGP); /* and wait for IRQ */ - return; } void @@ -1787,8 +1786,6 @@ siop_timeout(v) siop_cmd->cmd_c.flags |= CMDFL_TIMEOUT; siop_handle_reset(sc); splx(s); - - return; } #ifdef DUMP_SCRIPT @@ -1951,10 +1948,9 @@ bad0: bad1: siop_dmamem_free(sc, newcbd->xfers); bad2: - free(newcbd->cmds, M_DEVBUF, 0); + free(newcbd->cmds, M_DEVBUF, SIOP_NCMDPB * sizeof(struct siop_cmd)); bad3: - free(newcbd, M_DEVBUF, 0); - return; + free(newcbd, M_DEVBUF, sizeof *newcbd); } struct siop_lunsw * @@ -2264,7 +2260,7 @@ free: destroy: bus_dmamap_destroy(sc->sc_c.sc_dmat, sdm->sdm_map); sdmfree: - free(sdm, M_DEVBUF, 0); + free(sdm, M_DEVBUF, sizeof *sdm); return (NULL); } @@ -2276,6 +2272,6 @@ siop_dmamem_free(struct siop_softc *sc, struct siop_dmamem *sdm) bus_dmamem_unmap(sc->sc_c.sc_dmat, sdm->sdm_kva, sdm->sdm_size); bus_dmamem_free(sc->sc_c.sc_dmat, &sdm->sdm_seg, 1); bus_dmamap_destroy(sc->sc_c.sc_dmat, sdm->sdm_map); - free(sdm, M_DEVBUF, 0); + free(sdm, M_DEVBUF, sizeof *sdm); } diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c index 788f1d72578..89485b9f0d2 100644 --- a/sys/dev/ic/ti.c +++ b/sys/dev/ic/ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ti.c,v 1.16 2015/08/12 08:04:20 semarie Exp $ */ +/* $OpenBSD: ti.c,v 1.17 2015/09/09 18:24:26 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -427,7 +427,7 @@ ti_loadfw(struct ti_softc *sc) TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR, TI_FIRMWARE_FIX, tf->FwReleaseMajor, tf->FwReleaseMinor, tf->FwReleaseFix); - free(buf, M_DEVBUF, 0); + free(buf, M_DEVBUF, buflen); return; } ti_mem_write(sc, tf->FwTextAddr, tf->FwTextLen, @@ -439,7 +439,7 @@ ti_loadfw(struct ti_softc *sc) ti_mem_set(sc, tf->FwBssAddr, tf->FwBssLen); ti_mem_set(sc, tf->FwSbssAddr, tf->FwSbssLen); CSR_WRITE_4(sc, TI_CPU_PROGRAM_COUNTER, tf->FwStartAddr); - free(buf, M_DEVBUF, 0); + free(buf, M_DEVBUF, buflen); } /* @@ -870,7 +870,7 @@ ti_free_tx_ring(struct ti_softc *sc) while ((entry = SLIST_FIRST(&sc->ti_tx_map_listhead))) { SLIST_REMOVE_HEAD(&sc->ti_tx_map_listhead, link); bus_dmamap_destroy(sc->sc_dmatag, entry->dmamap); - free(entry, M_DEVBUF, 0); + free(entry, M_DEVBUF, sizeof *entry); } } @@ -1009,7 +1009,7 @@ ti_iff(struct ti_softc *sc) mc = SLIST_FIRST(&sc->ti_mc_listhead); ti_del_mcast(sc, &mc->mc_addr); SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries); - free(mc, M_DEVBUF, 0); + free(mc, M_DEVBUF, sizeof *mc); } /* Now program new ones. */ |