X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..04b8595b18b1b41ac7a206e4b3d51a635f8413d7:/iokit/Kernel/IODMAController.cpp?ds=inline diff --git a/iokit/Kernel/IODMAController.cpp b/iokit/Kernel/IODMAController.cpp index 558fde64e..faf7c20aa 100644 --- a/iokit/Kernel/IODMAController.cpp +++ b/iokit/Kernel/IODMAController.cpp @@ -51,7 +51,14 @@ IODMAController *IODMAController::getController(IOService *provider, UInt32 dmaI // Find the name of the parent dma controller dmaParentData = OSDynamicCast(OSData, provider->getProperty("dma-parent")); if (dmaParentData == 0) return NULL; - dmaParentName = createControllerName(*(UInt32 *)dmaParentData->getBytesNoCopy()); + + if (dmaParentData->getLength() == sizeof(UInt32)) { + dmaParentName = createControllerName(*(UInt32 *)dmaParentData->getBytesNoCopy()); + } else { + if (dmaIndex >= dmaParentData->getLength() / sizeof(UInt32)) + panic("dmaIndex out of range"); + dmaParentName = createControllerName(*(UInt32 *)dmaParentData->getBytesNoCopy(dmaIndex * sizeof(UInt32), sizeof(UInt32))); + } if (dmaParentName == 0) return NULL; // Wait for the parent dma controller