summaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/cnat_maglev.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2022-09-16 14:12:08 +0200
committerBeno�t Ganne <bganne@cisco.com>2022-09-19 15:47:32 +0000
commit6cacc94de3984d9f0cf6d562a27d89a4ab0a89f9 (patch)
tree5b7e66ad942e9cb46dc0f410958c3dcffa425db2 /src/plugins/cnat/cnat_maglev.c
parente95b246c7b87bf2a1d51d2061c72a9824a6ff047 (diff)
cnat: coverity fix
Type: fix Change-Id: Ib127331507724f853071e66ca1ddfc773a8ed200 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_maglev.c')
-rw-r--r--src/plugins/cnat/cnat_maglev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/cnat/cnat_maglev.c b/src/plugins/cnat/cnat_maglev.c
index 669c6479619..2cdb868b3d7 100644
--- a/src/plugins/cnat/cnat_maglev.c
+++ b/src/plugins/cnat/cnat_maglev.c
@@ -27,6 +27,8 @@ cnat_maglev_shuffle (cnat_maglev_perm_t *permutation, u32 *buckets)
return;
M = vec_len (buckets);
+ if (M == 0)
+ return;
vec_set (buckets, -1);
vec_validate (next, N - 1);
@@ -131,6 +133,8 @@ cnat_maglev_print_changes (vlib_main_t *vm, u32 *changed_bk_indices,
{
u32 good_flow_buckets = 0, reset_flow_buckets = 0, stable_to_reset = 0;
u32 reset_to_stable = 0, switched_stable = 0;
+ if (vec_len (new_maglev_lb) == 0)
+ return;
for (u32 i = 0; i < vec_len (new_maglev_lb); i++)
{
u8 is_new_changed =