⬢ DragonFlyBSD Kernel Audit
DF-5061 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/raid/ida/ida_pci.c	2026-09-26 18:11:04.560600585 +0000
+++ b/sys/dev/raid/ida/ida_pci.c	2026-09-26 18:11:04.580600323 +0000
@@ -104,7 +104,11 @@
 	bus_addr_t completed;
 
 	completed = ida_inl(ida, R_42XX_REPLY);
-	if (completed == -1)
+	/* R_42XX_REPLY is 32 bit; on LP64 bus_addr_t widens the read, so the
+	 * empty-FIFO 0xffffffff must be compared masked, never as
+	 * (bus_addr_t)-1, or the sentinel is dead code and an empty reply
+	 * FIFO is consumed as a completion (DF-5061). */
+	if (completed == (bus_addr_t)0xffffffffU)
 		return (0);			/* fifo is empty */
 	ida_outl(ida, R_42XX_REPLY, 0);		/* confirm read */
 	return (completed);