diff options
author | Shwetha Bhandari <shwethab@cisco.com> | 2017-02-14 10:39:06 +0530 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-02-14 06:59:18 +0000 |
commit | b05f1f0255b9a9b20381b621d187dd8b54911d9f (patch) | |
tree | cf193bffd2ca3589339527897f1981fd9086612e /src/plugins/ioam | |
parent | 0578cd1c6c03319187147874ac93b714a6e893b8 (diff) |
Fix coverity issues: ioam
Change-Id: I0963760a7da95612d5cab19596919b369a4d0f8e
Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r-- | src/plugins/ioam/analyse/ioam_analyse.h | 10 | ||||
-rw-r--r-- | src/plugins/ioam/analyse/ioam_summary_export.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/ioam/analyse/ioam_analyse.h b/src/plugins/ioam/analyse/ioam_analyse.h index a416cb1a..d5b6fbe5 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 00567323..afda3099 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); |