- Zero the whole packet in other packet allocation routines
authorCameron Gutman <aicommander@gmail.com>
Thu, 23 Apr 2009 10:32:41 +0000 (10:32 +0000)
committerCameron Gutman <aicommander@gmail.com>
Thu, 23 Apr 2009 10:32:41 +0000 (10:32 +0000)
 - Set ValidCount TRUE because we don't have any buffers chained yet
 - Set the fPACKET_ALLOCATED_BY_NDIS flag (fixes storing media-specific data)

svn path=/trunk/; revision=40664

reactos/drivers/network/ndis/ndis/buffer.c

index 2a7264b..3d1a71a 100644 (file)
@@ -426,6 +426,8 @@ NdisAllocatePacket(
 
         RtlZeroMemory(Temp, sizeof(NDIS_PACKET));
         Temp->Private.Pool = Pool;
+        Temp->Private.ValidCounts = TRUE;
+        Temp->Private.NdisPacketFlags = fPACKET_ALLOCATED_BY_NDIS;
 
         *Packet = Temp;
         *Status = NDIS_STATUS_SUCCESS;
@@ -705,8 +707,10 @@ NdisDprAllocatePacket(
 
         KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
 
-        RtlZeroMemory(&Temp->Private, sizeof(NDIS_PACKET_PRIVATE));
+        RtlZeroMemory(Temp, sizeof(NDIS_PACKET));
         Temp->Private.Pool = Pool;
+        Temp->Private.ValidCounts = TRUE;
+        Temp->Private.NdisPacketFlags = fPACKET_ALLOCATED_BY_NDIS;
 
         *Packet = Temp;
         *Status = NDIS_STATUS_SUCCESS;
@@ -752,8 +756,10 @@ NdisDprAllocatePacketNonInterlocked(
         Temp           = Pool->FreeList;
         Pool->FreeList = (PNDIS_PACKET)Temp->Reserved[0];
 
-        RtlZeroMemory(&Temp->Private, sizeof(NDIS_PACKET_PRIVATE));
+        RtlZeroMemory(Temp, sizeof(NDIS_PACKET));
         Temp->Private.Pool = Pool;
+        Temp->Private.ValidCounts = TRUE;
+        Temp->Private.NdisPacketFlags = fPACKET_ALLOCATED_BY_NDIS;
 
         *Packet = Temp;
         *Status = NDIS_STATUS_SUCCESS;
@@ -1102,4 +1108,4 @@ NdisUnchainBufferAtFront(
     *Buffer = NdisBuffer;
 }
 
-/* EOF */
+/* EOF */
\ No newline at end of file