summaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/analyse/ioam_analyse.h
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/plugins/ioam/analyse/ioam_analyse.h
parent0578cd1c6c03319187147874ac93b714a6e893b8 (diff)
Fix coverity issues: ioam
Change-Id: I0963760a7da95612d5cab19596919b369a4d0f8e Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
Diffstat (limited to 'src/plugins/ioam/analyse/ioam_analyse.h')
-rw-r--r--src/plugins/ioam/analyse/ioam_analyse.h10
1 files changed, 8 insertions, 2 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;
}