From a39d7ebfd504110ab3e84fa3990bd79f7ba2271f Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 12 Oct 2025 12:44:58 -0400 Subject: kern: xhci: Add NULL check to xhci_init_dcbaap() Signed-off-by: Ian Moffett --- src/sys/io/usb/hcd/xhci.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/sys/io/usb/hcd/xhci.c') diff --git a/src/sys/io/usb/hcd/xhci.c b/src/sys/io/usb/hcd/xhci.c index 0300367..e5a794a 100644 --- a/src/sys/io/usb/hcd/xhci.c +++ b/src/sys/io/usb/hcd/xhci.c @@ -150,6 +150,10 @@ xhci_init_dcbaap(struct xhci_hcd *hcd) uint32_t npages; void *va; + if (hcd == NULL) { + return -EINVAL; + } + npages = BYTES_TO_PAGES(hcd->max_slots * XHCI_CTX_SIZE); hcd->dcbaap_pa = vm_alloc_frame(npages); if (hcd->dcbaap_pa == 0) { -- cgit v1.2.3