Loading...
iokit/Kernel/IOBufferMemoryDescriptor.cpp xnu-3248.50.21 xnu-2782.30.5
--- xnu/xnu-3248.50.21/iokit/Kernel/IOBufferMemoryDescriptor.cpp
+++ xnu/xnu-2782.30.5/iokit/Kernel/IOBufferMemoryDescriptor.cpp
@@ -84,7 +84,7 @@
     int           options = 0; // KMA_LOMEM;
 
     kr = kernel_memory_allocate(kernel_map, &vmaddr,
-				page_size, 0, options, VM_KERN_MEMORY_IOKIT);
+				page_size, 0, options);
 
     if (KERN_SUCCESS != kr) vmaddr = 0;
     else 		    bzero((void *) vmaddr, page_size);
@@ -166,8 +166,6 @@
 	options |= kIOMemoryPhysicallyContiguous;
 
     _alignment = alignment;
-
-    if ((capacity + alignment) < _capacity) return (false);
 
     if ((inTask != kernel_task) && !(options & kIOMemoryPageable))
 	return false;
@@ -234,7 +232,7 @@
 	    {
 		IOStatisticsAlloc(kIOStatisticsMallocAligned, capacity);
 #if IOALLOCDEBUG
-		OSAddAtomic(capacity, &debug_iomalloc_size);
+		debug_iomalloc_size += capacity;
 #endif
 	    }
 	}
@@ -261,7 +259,7 @@
 
 	if( options & kIOMemoryPageable) {
 #if IOALLOCDEBUG
-	    OSAddAtomicLong(size, &debug_iomallocpageable_size);
+	    debug_iomallocpageable_size += size;
 #endif
 	    mapTask = inTask;
 	    if (NULL == inTask)
@@ -494,7 +492,7 @@
     if (options & kIOMemoryPageable)
     {
 #if IOALLOCDEBUG
-	OSAddAtomicLong(-(round_page(size)), &debug_iomallocpageable_size);
+	debug_iomallocpageable_size -= round_page(size);
 #endif
     }
     else if (buffer)
@@ -514,7 +512,7 @@
 		kmem_free(kernel_map, page, page_size);
 	    }
 #if IOALLOCDEBUG
-		OSAddAtomic(-size, &debug_iomalloc_size);
+	    debug_iomalloc_size -= size;
 #endif
 	    IOStatisticsAlloc(kIOStatisticsFreeAligned, size);
 	}
@@ -554,7 +552,6 @@
 void IOBufferMemoryDescriptor::setLength(vm_size_t length)
 {
     assert(length <= _capacity);
-    if (length > _capacity) return;
 
     _length = length;
     _ranges.v64->length = length;