aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2022-02-11 11:19:58 +0100
committerMauro Sardara <msardara@cisco.com>2022-03-11 09:53:11 +0000
commit8639e5c52c010233ee0068a4ab90b2d8084b4ba1 (patch)
tree4914a5262c6070973a3e9b0ef58570471bc7168a
parent9f0c28e7f2203213fa9ea01389d044dcce3f0afe (diff)
memif: Fix underflow
Type: fix Change-Id: Id183c47328510b5db7ffcc7a4dfb41f5a3151399 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> (cherry picked from commit 1b969c2f6a181d4f7cca542dad00e4feb1e45650)
-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]);