From 59ef1900870bbf991c1371b2a82f8d62061e2356 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 8 Sep 2015 08:33:27 +0000 Subject: sizes for free(); ok semarie --- sys/arch/i386/pci/glxsb.c | 6 +++--- sys/arch/i386/pci/pcibios.c | 6 ++++-- sys/arch/loongson/dev/bonito.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/i386/pci/glxsb.c b/sys/arch/i386/pci/glxsb.c index b1c1a1f3ea6..c93a86452b4 100644 --- a/sys/arch/i386/pci/glxsb.c +++ b/sys/arch/i386/pci/glxsb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxsb.c,v 1.29 2014/12/09 06:58:28 doug Exp $ */ +/* $OpenBSD: glxsb.c,v 1.30 2015/09/08 08:33:26 deraadt Exp $ */ /* * Copyright (c) 2006 Tom Cosgrove @@ -384,7 +384,7 @@ glxsb_crypto_newsession(uint32_t *sidp, struct cryptoini *cri) if (sesn != 0) { 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]; @@ -541,7 +541,7 @@ glxsb_crypto_freesession(uint64_t tid) explicit_bzero(swd->sw_octx, axf->ctxsize); free(swd->sw_octx, M_CRYPTO_DATA, 0); } - free(swd, M_CRYPTO_DATA, 0); + free(swd, M_CRYPTO_DATA, sizeof *swd); } explicit_bzero(&sc->sc_sessions[sesn], sizeof(sc->sc_sessions[sesn])); return (0); diff --git a/sys/arch/i386/pci/pcibios.c b/sys/arch/i386/pci/pcibios.c index 87edc29ebdf..10890e8d37b 100644 --- a/sys/arch/i386/pci/pcibios.c +++ b/sys/arch/i386/pci/pcibios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcibios.c,v 1.47 2015/09/08 04:28:34 semarie Exp $ */ +/* $OpenBSD: pcibios.c,v 1.48 2015/09/08 08:33:26 deraadt Exp $ */ /* $NetBSD: pcibios.c,v 1.5 2000/08/01 05:23:59 uch Exp $ */ /* @@ -321,7 +321,9 @@ pcibios_pir_init(struct pcibios_softc *sc) &pcibios_pir_header.exclusive_irq) != PCIBIOS_SUCCESS) { printf("%s: PCI IRQ Routing information unavailable.\n", sc->sc_dev.dv_xname); - free(pcibios_pir_table, M_DEVBUF, 0); + free(pcibios_pir_table, M_DEVBUF, + pcibios_pir_table_nentries * + sizeof(*pcibios_pir_table)); pcibios_pir_table = NULL; pcibios_pir_table_nentries = 0; return NULL; diff --git a/sys/arch/loongson/dev/bonito.c b/sys/arch/loongson/dev/bonito.c index be670c84fb2..0e5fc2212cf 100644 --- a/sys/arch/loongson/dev/bonito.c +++ b/sys/arch/loongson/dev/bonito.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bonito.c,v 1.28 2014/09/26 14:32:07 jsing Exp $ */ +/* $OpenBSD: bonito.c,v 1.29 2015/09/08 08:33:26 deraadt Exp $ */ /* $NetBSD: bonito_mainbus.c,v 1.11 2008/04/28 20:23:10 martin Exp $ */ /* $NetBSD: bonito_pci.c,v 1.5 2008/04/28 20:23:28 martin Exp $ */ @@ -468,7 +468,7 @@ bonito_intr_disestablish(void *vih) splx(s); - free(ih, M_DEVBUF, 0); + free(ih, M_DEVBUF, sizeof *ih); } /* @@ -1204,7 +1204,7 @@ bonito_get_resource_extent(pci_chipset_tag_t pc, int io) out: if (exname != NULL) - free(exname, M_DEVBUF, 0); + free(exname, M_DEVBUF, exnamesz); return ex; } -- cgit v1.2.3