aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-11-20 07:34:53 -0800
committerFlorin Coras <fcoras@cisco.com>2020-11-20 07:41:49 -0800
commit79b3f8ce33849fd789c8fc31b219373749ad9678 (patch)
treec0698b4ff8d9707ac6dc90b500f6e2d12738d16a /src
parentdc617b8df442f3e25197ec64ffd58d11411b0470 (diff)
svm: fix coverity warning
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icead1cbff69cf652fa566a79645c89864b6f3a0f
Diffstat (limited to 'src')
-rw-r--r--src/svm/fifo_segment.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index b0f41a92258..815c5a29e8d 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -63,13 +63,13 @@ fsh_update_free_bytes (fifo_segment_header_t * fsh)
}
static inline void
-fsh_cached_bytes_add (fifo_segment_header_t * fsh, int size)
+fsh_cached_bytes_add (fifo_segment_header_t * fsh, uword size)
{
clib_atomic_fetch_add_rel (&fsh->n_cached_bytes, size);
}
static inline void
-fsh_cached_bytes_sub (fifo_segment_header_t * fsh, int size)
+fsh_cached_bytes_sub (fifo_segment_header_t * fsh, uword size)
{
clib_atomic_fetch_sub_rel (&fsh->n_cached_bytes, size);
}
@@ -515,14 +515,15 @@ fsh_try_alloc_chunk_batch (fifo_segment_header_t * fsh,
fifo_segment_slice_t * fss,
u32 fl_index, u32 batch_size)
{
- u32 rounded_data_size;
svm_fifo_chunk_t *c, *head = 0, *tail;
+ uword size, total_chunk_bytes;
+ u32 rounded_data_size;
void *oldheap;
- uword size;
u8 *cmem;
int i;
rounded_data_size = fs_freelist_index_to_size (fl_index);
+ total_chunk_bytes = (uword) batch_size *rounded_data_size;
size = (uword) (sizeof (*c) + rounded_data_size) * batch_size;
oldheap = ssvm_push_heap (fsh->ssvm_sh);
@@ -549,8 +550,8 @@ fsh_try_alloc_chunk_batch (fifo_segment_header_t * fsh,
fss_chunk_free_list_push_list (fss, fl_index, head, tail);
fss->num_chunks[fl_index] += batch_size;
- fss_fl_chunk_bytes_add (fss, batch_size * rounded_data_size);
- fsh_cached_bytes_add (fsh, batch_size * rounded_data_size);
+ fss_fl_chunk_bytes_add (fss, total_chunk_bytes);
+ fsh_cached_bytes_add (fsh, total_chunk_bytes);
fsh_free_bytes_sub (fsh, size);
return 0;