summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-06 03:15:30 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-06 03:15:30 +0000
commit749fd17f08b39635d88e3fdda20531e25bf6e720 (patch)
tree6eaea12f2d4c24b82dd855b18fafc3748bb0cdb0
parentbe71528a93e3d4026ef3549be281bb786bd5ec4f (diff)
add sizes to free() calls
ok dhill
-rw-r--r--sys/dev/sdmmc/sdhc.c4
-rw-r--r--sys/dev/sdmmc/sdmmc.c8
-rw-r--r--sys/dev/sdmmc/sdmmc_mem.c4
-rw-r--r--sys/dev/sdmmc/sdmmc_scsi.c6
4 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c
index b2ed0f23afc..ca8fbaa4bc4 100644
--- a/sys/dev/sdmmc/sdhc.c
+++ b/sys/dev/sdmmc/sdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc.c,v 1.53 2017/01/21 05:42:04 guenther Exp $ */
+/* $OpenBSD: sdhc.c,v 1.54 2017/04/06 03:15:29 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -326,7 +326,7 @@ sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot,
return 0;
err:
- free(hp, M_DEVBUF, 0);
+ free(hp, M_DEVBUF, sizeof *hp);
sc->sc_host[sc->sc_nhosts - 1] = NULL;
sc->sc_nhosts--;
return (error);
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c
index c176c8b6100..8f20fd0546f 100644
--- a/sys/dev/sdmmc/sdmmc.c
+++ b/sys/dev/sdmmc/sdmmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc.c,v 1.45 2017/01/21 05:42:04 guenther Exp $ */
+/* $OpenBSD: sdmmc.c,v 1.46 2017/04/06 03:15:29 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -476,7 +476,7 @@ sdmmc_set_bus_power(struct sdmmc_softc *sc, u_int32_t host_ocr,
/* Mask off unsupported voltage levels and select the lowest. */
DPRINTF(1,("%s: host_ocr=%x ", DEVNAME(sc), host_ocr));
host_ocr &= card_ocr;
- for (bit = 4; bit < 23; bit++) {
+b for (bit = 4; bit < 23; bit++) {
if (ISSET(host_ocr, 1<<bit)) {
host_ocr &= 3<<bit;
break;
@@ -508,7 +508,7 @@ sdmmc_function_alloc(struct sdmmc_softc *sc)
void
sdmmc_function_free(struct sdmmc_function *sf)
{
- free(sf, M_DEVBUF, 0);
+ free(sf, M_DEVBUF, sizeof *sf);
}
/*
@@ -803,7 +803,7 @@ sdmmc_ioctl(struct device *self, u_long request, caddr_t addr)
exec_done:
if (ucmd->c_data)
- free(data, M_TEMP, 0);
+ free(data, M_TEMP, ucmd->c_datalen);
break;
default:
diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c
index bef4eb614ff..4d926ff0f63 100644
--- a/sys/dev/sdmmc/sdmmc_mem.c
+++ b/sys/dev/sdmmc/sdmmc_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_mem.c,v 1.29 2016/05/05 20:40:48 kettenis Exp $ */
+/* $OpenBSD: sdmmc_mem.c,v 1.30 2017/04/06 03:15:29 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -442,7 +442,7 @@ sdmmc_mem_send_cxd_data(struct sdmmc_softc *sc, int opcode, void *data,
out:
if (ptr != NULL)
- free(ptr, M_DEVBUF, 0);
+ free(ptr, M_DEVBUF, datalen);
return error;
}
diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c
index 2bd6388246a..0e4c98fb2c8 100644
--- a/sys/dev/sdmmc/sdmmc_scsi.c
+++ b/sys/dev/sdmmc/sdmmc_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_scsi.c,v 1.38 2017/01/21 05:42:04 guenther Exp $ */
+/* $OpenBSD: sdmmc_scsi.c,v 1.39 2017/04/06 03:15:29 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -152,7 +152,7 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
sdmmc_free_ccbs(scbus);
free_sctgt:
free(scbus->sc_tgt, M_DEVBUF, 0);
- free(scbus, M_DEVBUF, 0);
+ free(scbus, M_DEVBUF, sizeof *scbus);
}
void
@@ -182,7 +182,7 @@ sdmmc_scsi_detach(struct sdmmc_softc *sc)
free(scbus->sc_tgt, M_DEVBUF, 0);
sdmmc_free_ccbs(scbus);
- free(scbus, M_DEVBUF, 0);
+ free(scbus, M_DEVBUF, sizeof *scbus);
sc->sc_scsibus = NULL;
}