summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2022-02-11 11:19:58 +0100
committerDamjan Marion <dmarion@me.com>2022-02-13 20:10:58 +0000
commit1b969c2f6a181d4f7cca542dad00e4feb1e45650 (patch)
tree24391348ac1364553841d15e3fced165e3620606
parent360aee3e00c1211840b5a946a274ef1c496d5aa2 (diff)
memif: Fix underflow
Type: fix Change-Id: Id183c47328510b5db7ffcc7a4dfb41f5a3151399 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
-rw-r--r--src/plugins/memif/node.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 1f636f2b3a2..5bb10fc6eec 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -557,7 +557,7 @@ memif_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
vlib_get_buffers (vm, ptd->buffers, buffer_ptrs, n_buffers);
- for (i = 0; i < n_pkts - 8; i++)
+ for (i = 0; i + 8 < n_pkts; i++)
{
clib_prefetch_load (desc_data[i + 8]);
clib_prefetch_store (buffer_ptrs[i + 8]->data);
@@ -574,7 +574,7 @@ memif_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
u32 n_pkts = vec_len (ptd->copy_ops);
co = ptd->copy_ops;
- for (i = 0; i < n_pkts - 8; i++)
+ for (i = 0; i + 8 < n_pkts; i++)
{
clib_prefetch_load (co[i + 8].data);
b = vlib_get_buffer (vm, ptd->buffers[co[i].buffer_vec_index]);