Date: Mon, 13 Apr 2015 22:22:33 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r281505 - in stable: 10/usr.sbin/acpi/acpidump 8/usr.sbin/acpi/acpidump 9/usr.sbin/acpi/acpidump Message-ID: <201504132222.t3DMMXvu054860@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Mon Apr 13 22:22:32 2015 New Revision: 281505 URL: https://svnweb.freebsd.org/changeset/base/281505 Log: MFC: r281331 Do not crash when RSDT/XSDT contains an empty entry. Modified: stable/8/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/8/usr.sbin/acpi/acpidump/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/acpi/acpidump/acpi.c stable/9/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/10/ (props changed) stable/9/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/8/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/8/usr.sbin/acpi/acpidump/acpi.c Mon Apr 13 21:33:49 2015 (r281504) +++ stable/8/usr.sbin/acpi/acpidump/acpi.c Mon Apr 13 22:22:32 2015 (r281505) @@ -590,17 +590,10 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp) for (i = 0; i < entries; i++) { if (i > 0) printf(", "); - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - addr = 0; - } - assert(addr != 0); printf("0x%08lx", addr); } printf(" }\n"); @@ -857,17 +850,12 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp xsdt = (ACPI_TABLE_XSDT *)rsdp; entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size; for (i = 0; i < entries; i++) { - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - assert((addr = 0)); - } - + if (addr == 0) + continue; sdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr); if (acpi_checksum(sdp, sdp->Length)) { warnx("RSDT entry %d (sig %.4s) is corrupt", i, @@ -1056,16 +1044,12 @@ sdt_from_rsdt(ACPI_TABLE_HEADER *rsdp, c xsdt = (ACPI_TABLE_XSDT *)rsdp; entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size; for (i = 0; i < entries; i++) { - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - assert((addr = 0)); - } + if (addr == 0) + continue; sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr); if (last != NULL) { if (sdt == last)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504132222.t3DMMXvu054860>