# DF-1811 - Source Verification

## Verdict: REPRODUCED (source-only confirmation)

**Finding**: sys/dev/pccard/cardbus/cardbus_cis.c:360-368

**Mechanism**: decode_tuple_bar checks pci_bar!=0 BEFORE masking type bits. After mask, pci_bar can be 0 → ffs(0)=0 → 1<<(0-1) = 1<<-1 undefined behavior.

**Hardware dependency**: Requires CardBus PCI device with malicious BAR encoding.

**Fix**: Add if(pci_bar==0) return EINVAL after the type-bit mask.

## Verification method
Source-only confirmation. The cited code path was traced line-by-line in the
audited sys/ tree. The bug exists exactly as described. This is a HW-gated
driver finding — the vulnerable code path requires specific hardware (GPU,
controller, PHY, TPM, etc.) not present in the QEMU audit guest. Runtime
reproduction on this guest is not possible without the hardware.

## Fix validation
fix.diff authored and applied to guest source. All 40 fixes in this batch
compile cleanly in a single combined kernel build: `make -j6 nativekernel
KERNCONF=X86_64_GENERIC` → rc=0, zero -Werror violations.

**Kernel**: DragonFly 6.5-DEVELOPMENT #0: Thu Jul  2 06:02:54 UTC 2026
