git: 81dab94a5452 - main - acpi_pci_link: Ignore tunables with negative values

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 14 Nov 2026 16:03:28 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=81dab94a5452f996a063bdba2103eda4aa32b3d1

commit 81dab94a5452f996a063bdba2103eda4aa32b3d1
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-11-14 16:02:38 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-11-14 16:02:38 +0000

    acpi_pci_link: Ignore tunables with negative values
    
    IRQ values are unsigned and negative values do not make sense.  The
    invalid IRQ value (255) is already ignored, so ignoring other invalid
    values is consistent with that behavior.
    
    Reported by:    cperciva
---
 sys/dev/acpica/acpi_pci_link.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/acpica/acpi_pci_link.c b/sys/dev/acpica/acpi_pci_link.c
index d9807876c443..cb6adee87252 100644
--- a/sys/dev/acpica/acpi_pci_link.c
+++ b/sys/dev/acpica/acpi_pci_link.c
@@ -974,7 +974,8 @@ acpi_pci_link_choose_irq(device_t dev, struct link *link)
 	    sizeof(link_name)))) {
 		snprintf(tunable_buffer, sizeof(tunable_buffer),
 		    "hw.pci.link.%s.%d.irq", link_name, link->l_res_index);
-		if (getenv_int(tunable_buffer, &i) && PCI_INTERRUPT_VALID(i)) {
+		if (getenv_int(tunable_buffer, &i) && i >= 0 &&
+		    PCI_INTERRUPT_VALID(i)) {
 			if (!link_valid_irq(link, i))
 				device_printf(dev,
 				    "Warning, IRQ %d is not listed as valid\n",
@@ -983,7 +984,8 @@ acpi_pci_link_choose_irq(device_t dev, struct link *link)
 		}
 		snprintf(tunable_buffer, sizeof(tunable_buffer),
 		    "hw.pci.link.%s.irq", link_name);
-		if (getenv_int(tunable_buffer, &i) && PCI_INTERRUPT_VALID(i)) {
+		if (getenv_int(tunable_buffer, &i) && i >= 0 &&
+		    PCI_INTERRUPT_VALID(i)) {
 			if (!link_valid_irq(link, i))
 				device_printf(dev,
 				    "Warning, IRQ %d is not listed as valid\n",