linux-cp: fix coverity 216937 26/37026/3
authorAndrew Yourtchenko <ayourtch@gmail.com>
Fri, 26 Aug 2022 13:59:35 +0000 (13:59 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Fri, 26 Aug 2022 14:57:00 +0000 (14:57 +0000)
Initialize the host_sw_if_index to ~0 so in the error cases
the variable is set to something predictable.

Type: fix
Change-Id: Ic55e4f0cbfa286e85dfb54b89b5321af18a439a1
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
src/plugins/linux-cp/lcp_interface.c

index 4ca7c0c..d629a06 100644 (file)
@@ -778,7 +778,7 @@ lcp_itf_pair_create (u32 phy_sw_if_index, u8 *host_if_name,
 {
   vlib_main_t *vm;
   vnet_main_t *vnm;
-  u32 vif_index = 0, host_sw_if_index;
+  u32 vif_index = 0, host_sw_if_index = ~0;
   const vnet_sw_interface_t *sw;
   const vnet_hw_interface_t *hw;
   const lcp_itf_pair_t *lip;