Loading...
--- xnu/xnu-3248.50.21/iokit/Kernel/IOSharedDataQueue.cpp
+++ xnu/xnu-2782.1.97/iokit/Kernel/IOSharedDataQueue.cpp
@@ -99,11 +99,10 @@
if (dataQueue == 0) {
return false;
}
- bzero(dataQueue, allocSize);
dataQueue->queueSize = size;
-// dataQueue->head = 0;
-// dataQueue->tail = 0;
+ dataQueue->head = 0;
+ dataQueue->tail = 0;
if (!setQueueSize(size)) {
return false;
@@ -111,14 +110,7 @@
appendix = (IODataQueueAppendix *)((UInt8 *)dataQueue + size + DATA_QUEUE_MEMORY_HEADER_SIZE);
appendix->version = 0;
-
- if (!notifyMsg) {
- notifyMsg = IOMalloc(sizeof(mach_msg_header_t));
- if (!notifyMsg)
- return false;
- }
- bzero(notifyMsg, sizeof(mach_msg_header_t));
-
+ notifyMsg = &(appendix->msgh);
setNotificationPort(MACH_PORT_NULL);
return true;
@@ -129,10 +121,6 @@
if (dataQueue) {
IOFreeAligned(dataQueue, round_page(getQueueSize() + DATA_QUEUE_MEMORY_HEADER_SIZE + DATA_QUEUE_MEMORY_APPENDIX_SIZE));
dataQueue = NULL;
- if (notifyMsg) {
- IOFree(notifyMsg, sizeof(mach_msg_header_t));
- notifyMsg = NULL;
- }
}
if (_reserved) {
@@ -204,7 +192,7 @@
return false;
}
// Check for underflow of (getQueueSize() - tail)
- if (getQueueSize() < tail || getQueueSize() < head) {
+ if (getQueueSize() < tail) {
return false;
}