diff options
author | Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> | 2017-10-12 11:43:41 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-10-12 18:19:18 +0000 |
commit | 2096063b0856808326cbd2c1c8a3a786c98ea896 (patch) | |
tree | ba5faaace9d9d0ef3af2745b37d6f1684d676e5d /src/vnet/ipsec | |
parent | 0a47c99aed8124d2f4c3be0d90e961b82a6b9914 (diff) |
dpdk/ipsec: coverity fixes
Change-Id: Ica3bc74ffbb1c0df4e198b0abff8df10cdeb2182
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Diffstat (limited to 'src/vnet/ipsec')
-rw-r--r-- | src/vnet/ipsec/ipsec.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c index ba0d68bde97..828bfe81e43 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -414,6 +414,7 @@ ipsec_add_del_sa (vlib_main_t * vm, ipsec_sa_t * new_sa, int is_add) ipsec_sa_t *sa = 0; uword *p; u32 sa_index; + clib_error_t *err; clib_warning ("id %u spi %u", new_sa->id, new_sa->spi); @@ -433,9 +434,12 @@ ipsec_add_del_sa (vlib_main_t * vm, ipsec_sa_t * new_sa, int is_add) return VNET_API_ERROR_SYSCALL_ERROR_1; /* sa used in policy */ } hash_unset (im->sa_index_by_sa_id, sa->id); - if (im->cb.add_del_sa_sess_cb && - im->cb.add_del_sa_sess_cb (sa_index, 0) < 0) - return VNET_API_ERROR_SYSCALL_ERROR_1; + if (im->cb.add_del_sa_sess_cb) + { + err = im->cb.add_del_sa_sess_cb (sa_index, 0); + if (err) + return VNET_API_ERROR_SYSCALL_ERROR_1; + } pool_put (im->sad, sa); } else /* create new SA */ @@ -444,9 +448,12 @@ ipsec_add_del_sa (vlib_main_t * vm, ipsec_sa_t * new_sa, int is_add) clib_memcpy (sa, new_sa, sizeof (*sa)); sa_index = sa - im->sad; hash_set (im->sa_index_by_sa_id, sa->id, sa_index); - if (im->cb.add_del_sa_sess_cb && - im->cb.add_del_sa_sess_cb (sa_index, 1) < 0) - return VNET_API_ERROR_SYSCALL_ERROR_1; + if (im->cb.add_del_sa_sess_cb) + { + err = im->cb.add_del_sa_sess_cb (sa_index, 1); + if (err) + return VNET_API_ERROR_SYSCALL_ERROR_1; + } } return 0; } @@ -458,6 +465,7 @@ ipsec_set_sa_key (vlib_main_t * vm, ipsec_sa_t * sa_update) uword *p; u32 sa_index; ipsec_sa_t *sa = 0; + clib_error_t *err; p = hash_get (im->sa_index_by_sa_id, sa_update->id); if (!p) @@ -484,9 +492,12 @@ ipsec_set_sa_key (vlib_main_t * vm, ipsec_sa_t * sa_update) if (0 < sa_update->crypto_key_len || 0 < sa_update->integ_key_len) { - if (im->cb.add_del_sa_sess_cb && - im->cb.add_del_sa_sess_cb (sa_index, 0) < 0) - return VNET_API_ERROR_SYSCALL_ERROR_1; + if (im->cb.add_del_sa_sess_cb) + { + err = im->cb.add_del_sa_sess_cb (sa_index, 0); + if (err) + return VNET_API_ERROR_SYSCALL_ERROR_1; + } } return 0; |