diff options
| author | Varsha Rao <varao@redhat.com> | 2018-03-21 16:29:04 +0530 | 
|---|---|---|
| committer | Xavi Hernandez <xhernandez@redhat.com> | 2018-05-11 05:54:06 +0000 | 
| commit | 021b60858c562cd51dbeec8c00a61243c7189df2 (patch) | |
| tree | 336deee38905000b66a4edd940636b1eaf913925 /libglusterfs | |
| parent | 08dcb1c2bf02bba313d3bfc8fbc1c8ea63296321 (diff) | |
libglusterfs/stack: Fix coverity issue
Fix ARRAY_VS_SINGLETON coverity issue.
Change-Id: I9e70be026e80011dfc8fb0f06c4563895eb6daf4
fixes: bz#1558574
Signed-off-by: Varsha Rao <varao@redhat.com>
Diffstat (limited to 'libglusterfs')
| -rw-r--r-- | libglusterfs/src/stack.h | 13 | 
1 files changed, 11 insertions, 2 deletions
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;                                        \  | 
