]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IODMAController.cpp
xnu-3789.70.16.tar.gz
[apple/xnu.git] / iokit / Kernel / IODMAController.cpp
index 558fde64e78eefb699b4e5ffdccde2245d3d1c2c..faf7c20aa386fdc6f4ee7298155a78c45c9119be 100644 (file)
@@ -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