Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Dec 2025 15:43:50 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 88f8e3c5ab97 - main - acpi_apei: Remove the hest member from the softc
Message-ID:  <694ead36.d568.4445eb6d@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=88f8e3c5ab97025587d7df761c8ae72e2db6c1d3

commit 88f8e3c5ab97025587d7df761c8ae72e2db6c1d3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-26 15:36:24 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-26 15:36:24 +0000

    acpi_apei: Remove the hest member from the softc
    
    This is only used during attach and freed after use, so just use a
    local variable in the attach routine instead to avoid leaving a
    dangling pointer around in the softc.
    
    Reviewed by:    imp
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D54310
---
 sys/dev/acpica/acpi_apei.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c
index 0d23b504cb60..e85b3910e46d 100644
--- a/sys/dev/acpica/acpi_apei.c
+++ b/sys/dev/acpica/acpi_apei.c
@@ -86,7 +86,6 @@ struct apei_pges {
 };
 
 struct apei_softc {
-	ACPI_TABLE_HEST *hest;
 	TAILQ_HEAD(, apei_ge) ges;
 	struct apei_nges nges;
 	struct apei_iges iges;
@@ -562,9 +561,8 @@ hest_parse_structure(struct apei_softc *sc, void *addr, int remaining)
 }
 
 static void
-hest_parse_table(struct apei_softc *sc)
+hest_parse_table(ACPI_TABLE_HEST *hest, struct apei_softc *sc)
 {
-	ACPI_TABLE_HEST *hest = sc->hest;
 	char *cp;
 	int remaining, consumed;
 
@@ -662,6 +660,7 @@ static int
 apei_attach(device_t dev)
 {
 	struct apei_softc *sc = device_get_softc(dev);
+	ACPI_TABLE_HEADER *hest;
 	struct acpi_softc *acpi_sc;
 	struct apei_pges *pges;
 	struct apei_ge *ge;
@@ -691,11 +690,11 @@ apei_attach(device_t dev)
 	}
 
 	/* Search and parse HEST table. */
-	status = AcpiGetTable(ACPI_SIG_HEST, 0, (ACPI_TABLE_HEADER **)&sc->hest);
+	status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest);
 	if (ACPI_FAILURE(status))
 		return (ENXIO);
-	hest_parse_table(sc);
-	AcpiPutTable((ACPI_TABLE_HEADER *)sc->hest);
+	hest_parse_table((ACPI_TABLE_HEST *)hest, sc);
+	AcpiPutTable(hest);
 
 	rid = 0;
 	TAILQ_FOREACH(ge, &sc->ges, link) {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?694ead36.d568.4445eb6d>