Date: Wed, 10 Nov 2010 14:56:10 +0000 From: Paul B Mahol <onemda@gmail.com> To: net@freebsd.org Subject: ndis: properly allocate memory Message-ID: <AANLkTimJSYG4s0sF9Cfhz2NYoaY8LEkYu%2BqGWZ3dkjFY@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi,
Attached patch resolves buggy allocation of memory in NDISulator.
Correct behavior is to not ignore parameters specified by miniport driver.
[-- Attachment #2 --]
diff --git a/src/sys/compat/ndis/subr_ntoskrnl.c b/src/sys/compat/ndis/subr_ntoskrnl.c
index 04184ae..f169de5 100644
--- a/src/sys/compat/ndis/subr_ntoskrnl.c
+++ b/src/sys/compat/ndis/subr_ntoskrnl.c
@@ -2426,12 +2426,9 @@ MmAllocateContiguousMemorySpecifyCache(size, lowest, highest,
uint64_t boundary;
uint32_t cachetype;
{
- void *addr;
- size_t pagelength = roundup(size, PAGE_SIZE);
-
- addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
- return (addr);
+ return (contigmalloc(size, M_DEVBUF, M_ZERO|M_NOWAIT, lowest,
+ highest, PAGE_SIZE, boundary));
}
static void
@@ -2447,7 +2444,7 @@ MmFreeContiguousMemorySpecifyCache(base, size, cachetype)
uint32_t size;
uint32_t cachetype;
{
- ExFreePool(base);
+ contigfree(base, size, M_DEVBUF);
}
static uint32_t
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimJSYG4s0sF9Cfhz2NYoaY8LEkYu%2BqGWZ3dkjFY>
