The branch main has been updated by obiwac:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=542df51903ae57c5a5f271949a45ebcb1362d9b1

commit 542df51903ae57c5a5f271949a45ebcb1362d9b1
Author:     Aymeric Wibo <[email protected]>
AuthorDate: 2026-09-10 09:34:31 +0000
Commit:     Aymeric Wibo <[email protected]>
CommitDate: 2026-09-10 20:56:37 +0000

    acpi_spmc: Make sure constraints array doesn't end up sparse
    
    If we skip one of the constraint package elements and decrement
    sc->constraint_count, sc->constraints would end up sparse and some of
    our constraints would be put after sc->constraint_count.
    
    Reviewed by:    olce
    Sponsored by:   The FreeBSD Foundation
    Event:          EuroBSDCon Devsummit 2026
    Differential Revision:  https://reviews.freebsd.org/D59562
---
 sys/dev/acpica/acpi_spmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index d4d13d57d36e..8691354ff4d9 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -632,9 +632,9 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc 
*sc, ACPI_OBJECT *objec
         * iterate until object->Package.Count so we actually go over all
         * elements in the package.
         */
-       for (size_t i = 0; i < object->Package.Count; i++) {
+       for (size_t i = 0, j = 0; i < object->Package.Count; i++) {
                constraint_obj = &object->Package.Elements[i];
-               constraint = &sc->constraints[i];
+               constraint = &sc->constraints[j];
 
                constraint->enabled =
                    constraint_obj->Package.Elements[1].Integer.Value;
@@ -668,6 +668,8 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc 
*sc, ACPI_OBJECT *objec
                    constraint_package->Package.Elements[1].Integer.Value;
                constraint->min_dev_specific_state =
                    constraint_package->Package.Elements[2].Integer.Value;
+
+               j++;
        }
 
        return (0);

Reply via email to