]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[core] Replace memory allocator with a memory allocator that works natively with...
authorTzachi Dar <tzachid@mellanox.co.il>
Tue, 28 Sep 2010 17:26:21 +0000 (17:26 +0000)
committerTzachi Dar <tzachid@mellanox.co.il>
Tue, 28 Sep 2010 17:26:21 +0000 (17:26 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@2949 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/core/complib/kernel/cl_memory_osd.c
trunk/hw/mthca/kernel/mt_memory.h

index 6205a5a68626cca9b12a57ba741c942762f5ee3d..e5ea70d401e5ec3768a2b494c202844f92a7a2b2 100644 (file)
@@ -38,6 +38,10 @@ __cl_malloc_priv(
        IN      const size_t    size,\r
        IN      const boolean_t pageable )\r
 {\r
+       CL_ASSERT(size != 0);\r
+       if (size ==0) {\r
+               return NULL;\r
+       }\r
        if( pageable )\r
        {\r
                CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );\r
index fdfcbea700837d59e762cb3c7328d2b0fc0310ac..be94f85cc291eecf6c869f3c5f4e81d5ed99e894 100644 (file)
@@ -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 );