From 9da82e1fd89bd737f396aba53e9f1790a1e795f2 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 29 Aug 2015 20:55:35 +0000 Subject: firmware sizes are known; use them for free() --- sys/dev/ic/bwi.c | 8 ++++---- sys/dev/ic/fxp.c | 4 ++-- sys/dev/ic/rt2661.c | 4 ++-- sys/dev/ic/rt2860.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sys/dev/ic') diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index c5f30307681..5702da1f3bb 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.116 2015/02/10 23:25:46 mpi Exp $ */ +/* $OpenBSD: bwi.c,v 1.117 2015/08/29 20:55:34 deraadt Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -1652,7 +1652,7 @@ bwi_get_firmware(const char *name, const uint8_t *ucode, size_t size_ucode, } } - free(h, M_DEVBUF, 0); + free(h, M_DEVBUF, sizeof *h); return (ret); } @@ -1832,7 +1832,7 @@ void bwi_mac_fw_free(struct bwi_mac *mac) { if (mac->mac_fw != NULL) { - free(mac->mac_fw, M_DEVBUF, 0); + free(mac->mac_fw, M_DEVBUF, mac->mac_fw_size); mac->mac_fw = NULL; } } @@ -7826,7 +7826,7 @@ bwi_dma_txstats_free(struct bwi_softc *sc) bus_dmamap_unload(sc->sc_dmat, st->stats_dmap); bus_dmamem_free(sc->sc_dmat, &st->stats_seg, 1); - free(st, M_DEVBUF, 0); + free(st, M_DEVBUF, sizeof *st); } int diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 60f95db8ae2..094b898fff0 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.121 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: fxp.c,v 1.122 2015/08/29 20:55:34 deraadt Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -1048,7 +1048,7 @@ fxp_detach(struct fxp_softc *sc) #ifndef SMALL_KERNEL if (sc->sc_ucodebuf) - free(sc->sc_ucodebuf, M_DEVBUF, 0); + free(sc->sc_ucodebuf, M_DEVBUF, sc->sc_ucodelen); #endif } diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 97a7d36f893..40a46b478df 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.80 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: rt2661.c,v 1.81 2015/08/29 20:55:34 deraadt Exp $ */ /*- * Copyright (c) 2006 @@ -396,7 +396,7 @@ rt2661_detach(void *xsc) rt2661_free_rx_ring(sc, &sc->rxq); if (sc->ucode != NULL) - free(sc->ucode, M_DEVBUF, 0); + free(sc->ucode, M_DEVBUF, sc->ucsize); return 0; } diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index 98f472597fb..e4d39ff0584 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860.c,v 1.80 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: rt2860.c,v 1.81 2015/08/29 20:55:34 deraadt Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini @@ -392,7 +392,7 @@ rt2860_detach(void *xsc) rt2860_free_tx_pool(sc); if (sc->ucode != NULL) - free(sc->ucode, M_DEVBUF, 0); + free(sc->ucode, M_DEVBUF, sc->ucsize); return 0; } -- cgit v1.2.3