]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOBufferMemoryDescriptor.cpp
xnu-201.tar.gz
[apple/xnu.git] / iokit / Kernel / IOBufferMemoryDescriptor.cpp
index c209c70356e04857368c3817a64031f09905df37..2bf4b50e8f1fd18ff84d0aa6ab3b0c783f28d66e 100644 (file)
@@ -124,7 +124,7 @@ bool IOBufferMemoryDescriptor::initWithOptions(
 
         kern_return_t kr;
         ipc_port_t sharedMem = (ipc_port_t) _memEntry;
-        vm_size_t size = _ranges.v[0].length;
+        vm_size_t size = round_page(_ranges.v[0].length);
 
         // must create the entry before any pages are allocated
         if( 0 == sharedMem) {
@@ -132,7 +132,7 @@ bool IOBufferMemoryDescriptor::initWithOptions(
                         &size, _ranges.v[0].address,
                         VM_PROT_READ | VM_PROT_WRITE, &sharedMem,
                         NULL );
-            if( (KERN_SUCCESS == kr) && (size != _ranges.v[0].length)) {
+            if( (KERN_SUCCESS == kr) && (size != round_page(_ranges.v[0].length))) {
                 ipc_port_release_send( sharedMem );
                 kr = kIOReturnVMError;
             }