Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Mar 2026 23:16:52 +0000
From:      Olivier Cochard <olivier@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4d876fc5fc42 - main - acpi_spmc: fix revision check reading name as integer
Message-ID:  <69a76be4.3c1ab.43a6fdf3@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by olivier:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d876fc5fc427f9e4a110da5cc2ce62a21998b6c

commit 4d876fc5fc427f9e4a110da5cc2ce62a21998b6c
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-03-03 23:05:04 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-03-03 23:08:23 +0000

    acpi_spmc: fix revision check reading name as integer
    
    In acpi_spmc_get_constraints_spec(), the revision of the device
    constraint detail package was mistakenly read from
    constraint_obj->Package.Elements[0], which is the device name
    (a string), instead of from the detail sub-package's first element.
    
    Move the initialisation of 'detail' before the revision check and
    read the revision from detail->Package.Elements[0] as the comment
    already states
    
    Approved by:    obiwac
    Differential Revision:  https://reviews.freebsd.org/D55639
    Sponsored by:   Netflix
---
 sys/dev/acpica/acpi_spmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index e8ed14fdcb1b..6b4363bb364d 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -322,11 +322,12 @@ acpi_spmc_get_constraints_spec(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
 			return (ENOMEM);
 		}
 
+		detail = &constraint_obj->Package.Elements[2];
 		/*
 		 * The first element in the device constraint detail package is
 		 * the revision, and should always be zero.
 		 */
-		revision = constraint_obj->Package.Elements[0].Integer.Value;
+		revision = detail->Package.Elements[0].Integer.Value;
 		if (revision != 0) {
 			device_printf(sc->dev, "Unknown revision %d for "
 			    "device constraint detail package\n", revision);
@@ -334,7 +335,6 @@ acpi_spmc_get_constraints_spec(struct acpi_spmc_softc *sc, ACPI_OBJECT *object)
 			continue;
 		}
 
-		detail = &constraint_obj->Package.Elements[2];
 		constraint_package = &detail->Package.Elements[1];
 
 		constraint->lpi_uid =


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a76be4.3c1ab.43a6fdf3>