git: 1eb7099eacea - main - acpidump: improve length calculation for several IVHD elements

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 31 May 2024 19:18:09 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=1eb7099eaceacd4e26606b074db6633ca7e5359a

commit 1eb7099eaceacd4e26606b074db6633ca7e5359a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-05-30 15:21:59 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-05-31 19:10:39 +0000

    acpidump: improve length calculation for several IVHD elements
    
    Use sizeofs of structures corresponding to the parsed device entry.
    This does not change the calculation, but fixes logical inconsistency.
    
    Sponsored by:   The FreeBSD Foundation
    Sponsored by:   Advanced Micro Devices (AMD)
    MFC after:      1 week
---
 usr.sbin/acpi/acpidump/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index fc2e8cb82c49..af0068649fbb 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -1629,8 +1629,8 @@ acpi_handle_ivrs_ivhd_devs(ACPI_IVRS_DE_HEADER *d, char *de)
 		} else if (d->Type == ACPI_IVRS_TYPE_EXT_START) {
 			d8b = (ACPI_IVRS_DEVICE8B *)db;
 			len = sizeof(*d8b);
-			d4 = (ACPI_IVRS_DEVICE4 *)(db + sizeof(*d8a));
-			len = sizeof(*d8a) + sizeof(*d4);
+			d4 = (ACPI_IVRS_DEVICE4 *)(db + sizeof(*d8b));
+			len = sizeof(*d8b) + sizeof(*d4);
 			printf("\t\tDev Type=%#x Id=%#06x-%#06x",
 			    d8a->Header.Type, d8a->Header.Id, d4->Header.Id);
 			acpi_handle_ivrs_ivhd_dte(d8b->Header.DataSetting);