From d01caf7fa215d2cbea8cfab1d3d0b6d9d04a5661 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Tue, 9 Mar 2021 09:25:33 +0100 Subject: pnat: coverity fixes Type: fix Signed-off-by: Ole Troan Change-Id: Ia1cfdbd39ed458cb3fffd29a8b6d6eff64644de8 --- MAINTAINERS | 5 +++++ src/plugins/nat/pnat/pnat.c | 6 ++++-- src/plugins/nat/pnat/pnat_api.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 27b6b291554..c70c31f96ae 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -389,6 +389,11 @@ M: Filip Varga M: Klement Sekera F: src/plugins/nat/ +Plugin - PNAT Static match and rewrite engine +I: pnat +M: Ole Troan +F: src/plugins/nat/pnat/ + Plugin - AVF Device driver I: avf M: Damjan Marion diff --git a/src/plugins/nat/pnat/pnat.c b/src/plugins/nat/pnat/pnat.c index 335d2750ce7..a47521f1747 100644 --- a/src/plugins/nat/pnat/pnat.c +++ b/src/plugins/nat/pnat/pnat.c @@ -148,13 +148,15 @@ static int pnat_disable_interface(u32 sw_if_index, return 0; if (interface->enabled[attachment] && attachment == PNAT_IP4_INPUT) { - ip4_sv_reass_enable_disable_with_refcnt(sw_if_index, 0); + if (ip4_sv_reass_enable_disable_with_refcnt(sw_if_index, 0) != 0) + return -1; if (vnet_feature_enable_disable("ip4-unicast", "pnat-input", sw_if_index, 0, 0, 0) != 0) return -1; } if (interface->enabled[attachment] && attachment == PNAT_IP4_OUTPUT) { - ip4_sv_reass_output_enable_disable_with_refcnt(sw_if_index, 0); + if (ip4_sv_reass_output_enable_disable_with_refcnt(sw_if_index, 0) != 0) + return -1; if (vnet_feature_enable_disable("ip4-output", "pnat-output", sw_if_index, 0, 0, 0) != 0) return -1; diff --git a/src/plugins/nat/pnat/pnat_api.c b/src/plugins/nat/pnat/pnat_api.c index dad658c3e9e..cb7afaaedb1 100644 --- a/src/plugins/nat/pnat/pnat_api.c +++ b/src/plugins/nat/pnat/pnat_api.c @@ -145,7 +145,7 @@ static void send_interfaces_details(u32 index, vl_api_registration_t *rp, rmp->sw_if_index = i->sw_if_index; clib_memcpy(rmp->enabled, i->enabled, PNAT_ATTACHMENT_POINT_MAX); clib_memcpy(rmp->lookup_mask, i->lookup_mask, - sizeof(i->lookup_mask) * PNAT_ATTACHMENT_POINT_MAX); + sizeof(vl_api_pnat_mask_t) * PNAT_ATTACHMENT_POINT_MAX); /* Endian hack until apigen registers _details * endian functions */ -- cgit 1.2.3-korg