aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/svm/svm_fifo.c')
-rw-r--r--src/svm/svm_fifo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index 3552192a768..dbdb813a7df 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -622,14 +622,14 @@ void
svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
{
u32 first_chunk;
+ first_chunk = f->nitems - f->head;
ASSERT (len <= f->nitems);
- if (len < f->nitems - f->head)
+ if (len <= first_chunk)
clib_memcpy (&f->data[f->head], data, len);
else
{
- first_chunk = len - (f->nitems - f->head);
clib_memcpy (&f->data[f->head], data, first_chunk);
- clib_memcpy (f->data, data + first_chunk, len - first_chunk);
+ clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
}
}