summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-27 16:34:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-27 16:34:19 +0000
commit3c896b4ed056d1e873ab05745d3bed07a55c3432 (patch)
treec69859268c7f85acc0c930d3469827c67aa0604e /sys/dev
parent6467221b7e8e4dd220b0e3f853f2700f3aa5f538 (diff)
track size of pss allocation, so that length can be passed to free(9)
ok mlarkin
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpicpu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c
index 182dc87e437..4f42ec3f985 100644
--- a/sys/dev/acpi/acpicpu.c
+++ b/sys/dev/acpi/acpicpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpicpu.c,v 1.79 2017/04/07 04:45:24 guenther Exp $ */
+/* $OpenBSD: acpicpu.c,v 1.80 2017/04/27 16:34:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
@@ -136,10 +136,11 @@ struct acpicpu_softc {
struct acpi_softc *sc_acpi;
struct aml_node *sc_devnode;
- int sc_pss_len;
+ int sc_pss_len; /* XXX */
int sc_ppc;
int sc_level;
struct acpicpu_pss *sc_pss;
+ size_t sc_pssfulllen;
struct acpicpu_pct sc_pct;
/* save compensation for pct access for lying bios' */
@@ -679,8 +680,6 @@ acpicpu_attach(struct device *parent, struct device *self, void *aux)
SLIST_INIT(&sc->sc_cstates);
- sc->sc_pss = NULL;
-
if (aml_evalnode(sc->sc_acpi, sc->sc_devnode, 0, NULL, &res) == 0) {
if (res.type == AML_OBJTYPE_PROCESSOR) {
sc->sc_cpu = res.v_processor.proc_id;
@@ -928,10 +927,11 @@ acpicpu_getpss(struct acpicpu_softc *sc)
return (1);
}
- free(sc->sc_pss, M_DEVBUF, 0);
+ free(sc->sc_pss, M_DEVBUF, sc->sc_pssfulllen);
sc->sc_pss = mallocarray(res.length, sizeof(*sc->sc_pss), M_DEVBUF,
M_WAITOK | M_ZERO);
+ sc->sc_pssfulllen = res.length * sizeof(*sc->sc_pss);
c = 0;
for (i = 0; i < res.length; i++) {