summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShwetha Bhandari <shwethab@cisco.com>2017-02-14 10:39:06 +0530
committerFlorin Coras <florin.coras@gmail.com>2017-02-14 06:59:18 +0000
commitb05f1f0255b9a9b20381b621d187dd8b54911d9f (patch)
treecf193bffd2ca3589339527897f1981fd9086612e /src
parent0578cd1c6c03319187147874ac93b714a6e893b8 (diff)
Fix coverity issues: ioam
Change-Id: I0963760a7da95612d5cab19596919b369a4d0f8e Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/ioam/analyse/ioam_analyse.h10
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c2
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c11
3 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/ioam/analyse/ioam_analyse.h b/src/plugins/ioam/analyse/ioam_analyse.h
index a416cb1a597..d5b6fbe52a9 100644
--- a/src/plugins/ioam/analyse/ioam_analyse.h
+++ b/src/plugins/ioam/analyse/ioam_analyse.h
@@ -131,6 +131,9 @@ ip6_ioam_analyse_calc_delay (ioam_trace_hdr_t * trace, u16 trace_len)
u32 start_time, end_time;
size_of_traceopt_per_node = fetch_trace_data_size (trace->ioam_trace_type);
+ // Unknown trace type
+ if (size_of_traceopt_per_node == 0)
+ return 0;
size_of_all_traceopts = trace_len; /*ioam_trace_type,data_list_elts_left */
num_nodes = (u8) (size_of_all_traceopts / size_of_traceopt_per_node);
@@ -140,7 +143,7 @@ ip6_ioam_analyse_calc_delay (ioam_trace_hdr_t * trace, u16 trace_len)
start_elt = trace->elts;
end_elt =
trace->elts +
- (size_of_traceopt_per_node * (num_nodes - 1) / sizeof (u32));
+ (u32) (size_of_traceopt_per_node * (num_nodes - 1) / sizeof (u32));
if (trace->ioam_trace_type & BIT_TTL_NODEID)
{
@@ -180,6 +183,9 @@ ip6_ioam_analyse_hbh_trace (ioam_analyser_data_t * data,
trace_data = &data->trace_data;
size_of_traceopt_per_node = fetch_trace_data_size (trace->ioam_trace_type);
+ // Unknown trace type
+ if (size_of_traceopt_per_node == 0)
+ goto DONE;
size_of_all_traceopts = trace_len;
ptr = (u8 *) trace->elts;
@@ -281,7 +287,7 @@ found_match:
trace_record->mean_delay =
(u32) ((sum + delay) / (data->seqno_data.rx_packets + 1));
}
-
+DONE:
*(data->writer_lock) = 0;
return 0;
}
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 0056732327c..afda3099c9a 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -312,7 +312,6 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
tp = vlib_buffer_get_current (b0);
ip = &tp->ip4;
- udp = &tp->udp;
h = &tp->ipfix.h;
s = &tp->ipfix.s;
@@ -394,6 +393,7 @@ ioam_flow_create (u8 del)
u32 domain_id = 0;
flow_report_main_t *frm = &flow_report_main;
+ memset (&args, 0, sizeof (args));
args.rewrite_callback = ioam_template_rewrite;
args.flow_data_callback = ioam_send_flows;
del ? (args.is_add = 0) : (args.is_add = 1);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index e51b585e1be..9412885da65 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -982,15 +982,16 @@ lisp_gpe_nsh_update_fwding (lisp_gpe_fwd_entry_t * lfe)
/* We have only one nsh-lisp interface (no NSH virtualization) */
hip = hash_get (lgm->nsh_ifaces.hw_if_index_by_dp_table, 0);
- hi = vnet_get_hw_interface (lgm->vnet_main, hip[0]);
-
- dpo_stack_from_node (hi->tx_node_index, &lfe->nsh.choice, &dpo);
-
+ if (hip)
+ {
+ hi = vnet_get_hw_interface (lgm->vnet_main, hip[0]);
+ dpo_stack_from_node (hi->tx_node_index, &lfe->nsh.choice, &dpo);
+ }
/* add entry to nsh lisp fib */
lisp_nsh_fib_add_del_entry (fid_addr_nsh (&lfe->key->rmt),
lfe - lgm->lisp_fwd_entry_pool, 1);
-
dpo_reset (&dpo);
+
}
/**