From 08fcdbb95cd7ab3fc1246f03c3ef27c0b8a0d218 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Wed, 30 Dec 2015 10:10:41 -0600 Subject: [PATCH] LU-7084 obd: correct some OBD allocator macro defines Use protective parentheses around instances of the GFP mask parameters in the definitions of __OBD_MALLOC_VERBOSE() and __OBD_SLAB_ALLOC_VERBOSE() to prevent unexpected expansions. Signed-off-by: John L. Hammond Change-Id: I0c3307ae488fb4f79a07db8a3b870dbcb609da0b Reviewed-on: http://review.whamcloud.com/17755 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Reviewed-by: Mike Pershin --- lustre/include/obd_support.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 5f74f80..80a31df 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -688,8 +688,8 @@ static inline void obd_memory_sub(long size) #define __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, flags) \ do { \ (ptr) = (cptab) == NULL ? \ - kmalloc(size, flags | __GFP_ZERO) : \ - cfs_cpt_malloc(cptab, cpt, size, flags | __GFP_ZERO); \ + kmalloc(size, (flags) | __GFP_ZERO) : \ + cfs_cpt_malloc(cptab, cpt, size, (flags) | __GFP_ZERO); \ if (likely((ptr) != NULL)) \ OBD_ALLOC_POST(ptr, size, "kmalloced"); \ } while (0) @@ -802,10 +802,10 @@ do { \ #define __OBD_SLAB_ALLOC_VERBOSE(ptr, slab, cptab, cpt, size, type) \ do { \ - LASSERT(ergo((type) != GFP_ATOMIC, !in_interrupt())); \ + LASSERT(ergo((type) != GFP_ATOMIC, !in_interrupt())); \ (ptr) = (cptab) == NULL ? \ - kmem_cache_alloc(slab, type | __GFP_ZERO) : \ - cfs_mem_cache_cpt_alloc(slab, cptab, cpt, type | __GFP_ZERO); \ + kmem_cache_alloc(slab, (type) | __GFP_ZERO) : \ + cfs_mem_cache_cpt_alloc(slab, cptab, cpt, (type) | __GFP_ZERO); \ if (likely((ptr))) \ OBD_ALLOC_POST(ptr, size, "slab-alloced"); \ } while(0) -- 1.8.3.1