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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index e017b619d15..3824d998866 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -677,7 +677,10 @@ svm_fifo_reduce_size (svm_fifo_t * f, u32 len, u8 try_shrink)
svm_fifo_chunk_t *cur;
u32 actual_len = 0;
- if (len > f->nitems)
+ /* Abort if trying to reduce by more than fifo size or if
+ * fifo is undergoing resizing already */
+ if (len >= f->size || f->size > f->nitems + 1
+ || (f->flags & SVM_FIFO_F_SHRINK) || (f->flags & SVM_FIFO_F_GROW))
return 0;
/* last chunk that will not be removed */