From 021b60858c562cd51dbeec8c00a61243c7189df2 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 21 Mar 2018 16:29:04 +0530 Subject: libglusterfs/stack: Fix coverity issue Fix ARRAY_VS_SINGLETON coverity issue. Change-Id: I9e70be026e80011dfc8fb0f06c4563895eb6daf4 fixes: bz#1558574 Signed-off-by: Varsha Rao --- libglusterfs/src/stack.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 18cbf39621a..f7f4b4ad9a7 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -284,8 +284,13 @@ STACK_RESET (call_stack_t *stack) GF_ATOMIC_INC (next_xl->stats.total.count); \ GF_ATOMIC_INC (next_xl->stats.interval.count); \ } \ + \ if (next_xl->pass_through) { \ - next_xl_fn = (void *)*((&next_xl->pass_through_fops->stat) + (opn - 1)); \ + /* next_xl_fn = (void *)*((&next_xl->pass_through_fops->stat) + (opn - 1)); + * This assignment is changed to fix ARRAY_VS_SINGLETON coverity error. + */ \ + void *base_addr = &next_xl->pass_through_fops->stat; \ + next_xl_fn = base_addr + ((opn - 1) * sizeof(void*)); \ } \ next_xl_fn (frame, next_xl, params); \ THIS = old_THIS; \ @@ -350,7 +355,11 @@ STACK_RESET (call_stack_t *stack) GF_ATOMIC_INC (obj->stats.total.count); \ GF_ATOMIC_INC (obj->stats.interval.count); \ } else { \ - next_xl_fn = (void *)*((&obj->pass_through_fops->stat) + (_new->op - 1)); \ + /* next_xl_fn = (void *)*((&obj->pass_through_fops->stat) + (_new->op - 1)); + * This assignment is changed to fix ARRAY_VS_SINGLETON coverity error. + */ \ + void *base_addr = &obj->pass_through_fops->stat; \ + next_xl_fn = base_addr + ((_new->op - 1) * sizeof(void*)); \ } \ next_xl_fn (_new, obj, params); \ THIS = old_THIS; \ -- cgit