From: Tzachi Dar Date: Tue, 28 Sep 2010 17:26:21 +0000 (+0000) Subject: [core] Replace memory allocator with a memory allocator that works natively with... X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=dc8ac4b612d1fca70e67f1ff0a468bd91e7865cd;p=~shefty%2Frdma-win.git [core] Replace memory allocator with a memory allocator that works natively with 0 bytes allocations git-svn-id: svn://openib.tc.cornell.edu/gen1@2949 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/core/complib/kernel/cl_memory_osd.c b/trunk/core/complib/kernel/cl_memory_osd.c index 6205a5a6..e5ea70d4 100644 --- a/trunk/core/complib/kernel/cl_memory_osd.c +++ b/trunk/core/complib/kernel/cl_memory_osd.c @@ -38,6 +38,10 @@ __cl_malloc_priv( IN const size_t size, IN const boolean_t pageable ) { + CL_ASSERT(size != 0); + if (size ==0) { + return NULL; + } if( pageable ) { CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL ); diff --git a/trunk/hw/mthca/kernel/mt_memory.h b/trunk/hw/mthca/kernel/mt_memory.h index fdfcbea7..be94f85c 100644 --- a/trunk/hw/mthca/kernel/mt_memory.h +++ b/trunk/hw/mthca/kernel/mt_memory.h @@ -50,6 +50,10 @@ static inline void * kmalloc( SIZE_T bsize, unsigned int gfp_mask) { void *ptr; MT_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL ); + MT_ASSERT(bsize); + if(bsize == 0) { + return NULL; + } switch (gfp_mask) { case GFP_ATOMIC: ptr = ExAllocatePoolWithTag( NonPagedPool, bsize, MT_TAG_ATOMIC );