[ovs-dev] [PATCH] netdev-linux.c: Fix coverity unreachable code warning

ua1422 at gmail.com ua1422 at gmail.com
Tue Mar 31 18:32:38 UTC 2020


From: Usman Ansari <ua1422 at gmail.com>

Coverity reports unreachable code in "?" statement
Fixed by removing code segment and unused variables

Signed-off-by: Usman Ansari <ua1422 at gmail.com>
---
 lib/netdev-linux.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index c6e46f1..3a1cea0 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2621,9 +2621,8 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t kbits_rate,
     uint16_t eth_type = (OVS_FORCE uint16_t) htons(ETH_P_ALL);
     size_t basic_offset, action_offset, inner_offset;
     uint16_t prio = TC_RESERVED_PRIORITY_POLICE;
-    int ifindex, index, err = 0;
+    int ifindex, err = 0;
     struct tc_police pol_act;
-    uint32_t block_id = 0;
     struct ofpbuf request;
     struct ofpbuf *reply;
     struct tcmsg *tcmsg;
@@ -2634,10 +2633,9 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t kbits_rate,
         return err;
     }
 
-    index = block_id ? TCM_IFINDEX_MAGIC_BLOCK : ifindex;
-    tcmsg = tc_make_request(index, RTM_NEWTFILTER, NLM_F_CREATE | NLM_F_ECHO,
+    tcmsg = tc_make_request(ifindex, RTM_NEWTFILTER, NLM_F_CREATE | NLM_F_ECHO,
                             &request);
-    tcmsg->tcm_parent = block_id ? : TC_INGRESS_PARENT;
+    tcmsg->tcm_parent = TC_INGRESS_PARENT;
     tcmsg->tcm_info = tc_make_handle(prio, eth_type);
     tcmsg->tcm_handle = handle;
 
-- 
2.7.4



More information about the dev mailing list