From a1cf80b493137b00d9111d4d15405a12237ea9bd Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 19 Feb 2009 12:28:10 -0800 Subject: [PATCH] Matching kmem_free() fix for use after free case. See commit bb01879ebe5ba5d8e2c2177d3b1ce0272c17ce07 for a full description. This issue should have been addressed in the same commit but it slipped my mind. --- include/sys/kmem.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/sys/kmem.h b/include/sys/kmem.h index 278039e..318cf5e 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -126,9 +126,9 @@ extern void vmem_free_debug(void *ptr, size_t size); #else /* DEBUG_KMEM */ -# define kmem_alloc(size, flags) kmalloc((size), (flags)) -# define kmem_zalloc(size, flags) kzalloc((size), (flags)) -# define kmem_free(ptr, size) (kfree(ptr), (void)(size)) +# define kmem_alloc(size, flags) kmalloc((size), (flags)) +# define kmem_zalloc(size, flags) kzalloc((size), (flags)) +# define kmem_free(ptr, size) ((void)(size), kfree(ptr)) # ifdef HAVE_KMALLOC_NODE # define kmem_alloc_node(size, flags, node) \ @@ -138,8 +138,8 @@ extern void vmem_free_debug(void *ptr, size_t size); kmalloc((size), (flags)) # endif -# define vmem_alloc(size, flags) __vmalloc((size), ((flags) | \ - __GFP_HIGHMEM), PAGE_KERNEL) +# define vmem_alloc(size, flags) __vmalloc((size), ((flags) | \ + __GFP_HIGHMEM), PAGE_KERNEL) # define vmem_zalloc(size, flags) \ ({ \ void *_ptr_ = __vmalloc((size),((flags)|__GFP_HIGHMEM),PAGE_KERNEL); \ -- 2.40.0