diff options
author | Neale Ranns <nranns@cisco.com> | 2017-11-15 10:44:07 -0800 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-11-15 19:45:47 +0000 |
commit | 93149bb4cd0a137b2a6da4b0d9f8cb2032e44734 (patch) | |
tree | 5818b346974d496f784050220ffca9a86052df4f /src | |
parent | b8a0d2cf9ff8796123b3c167c051f78ab03cc4cf (diff) |
BIER: coverity fixes
Change-Id: I657bade082f9f754b294cd5f23ecfad4f0f46265
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/bier/bier_api.c | 2 | ||||
-rw-r--r-- | src/vnet/bier/bier_disp_table.c | 6 | ||||
-rw-r--r-- | src/vnet/bier/bier_disp_table.h | 2 | ||||
-rw-r--r-- | src/vnet/bier/bier_test.c | 2 | ||||
-rw-r--r-- | src/vnet/bier/bier_update.c | 5 | ||||
-rw-r--r-- | src/vnet/fib/fib_test.c | 16 |
6 files changed, 22 insertions, 11 deletions
diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c index aacee0910bf..cd1f40b1eaa 100644 --- a/src/vnet/bier/bier_api.c +++ b/src/vnet/bier/bier_api.c @@ -178,7 +178,7 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp) brpath->frp_flags = FIB_ROUTE_PATH_BIER_FMASK; vec_validate(brpath->frp_label_stack, - mp->br_paths[ii].n_labels); + mp->br_paths[ii].n_labels - 1); for (jj = 0; jj < mp->br_paths[ii].n_labels; jj++) { brpath->frp_label_stack[jj] = diff --git a/src/vnet/bier/bier_disp_table.c b/src/vnet/bier/bier_disp_table.c index b2541dacc4d..47d23e8ac3b 100644 --- a/src/vnet/bier/bier_disp_table.c +++ b/src/vnet/bier/bier_disp_table.c @@ -206,9 +206,11 @@ bier_disp_table_entry_remove (index_t bdti, static index_t bier_disp_table_lookup_hton(index_t bdti, - bier_bp_t src) + bier_bp_t bp) { - return (bier_disp_table_lookup(bdti, clib_host_to_net_u16(src))); + bier_hdr_src_id_t src = bp; + + return (bier_disp_table_lookup(bdti, clib_host_to_net_u32(src))); } void diff --git a/src/vnet/bier/bier_disp_table.h b/src/vnet/bier/bier_disp_table.h index 18726c8ee6a..6f9380a507f 100644 --- a/src/vnet/bier/bier_disp_table.h +++ b/src/vnet/bier/bier_disp_table.h @@ -98,7 +98,7 @@ bier_disp_table_get (index_t bdti) static inline index_t bier_disp_table_lookup (index_t bdti, - bier_bp_t src) + bier_hdr_src_id_t src) { bier_disp_table_t *bdt; diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c index 6119410edfa..f0e7b0cab2f 100644 --- a/src/vnet/bier/bier_test.c +++ b/src/vnet/bier/bier_test.c @@ -836,7 +836,7 @@ bier_test_mpls_disp (void) .frp_rpf_id = 9, // some non-zero value .frp_flags = FIB_ROUTE_PATH_RPF_ID, }; - u16 src = 99; + bier_hdr_src_id_t src = 99; vec_add1(rpaths, path_via_mfib); bier_disp_table_entry_path_add(bier_disp_tbl_id, src, BIER_HDR_PROTO_IPV4, rpaths); diff --git a/src/vnet/bier/bier_update.c b/src/vnet/bier/bier_update.c index ddbdd72f8ee..170893d45b6 100644 --- a/src/vnet/bier/bier_update.c +++ b/src/vnet/bier/bier_update.c @@ -76,7 +76,7 @@ vnet_bier_route_cmd (vlib_main_t * vm, vlib_cli_command_t * cmd) { clib_error_t * error = NULL; - fib_route_path_t brp = { + fib_route_path_t *brps = NULL, brp = { .frp_flags = FIB_ROUTE_PATH_BIER_FMASK, }; bier_table_id_t bti = { @@ -104,6 +104,7 @@ vnet_bier_route_cmd (vlib_main_t * vm, } } + vec_add1(brps, brp); bti.bti_hdr_len = bier_hdr_bit_len_to_id(hdr_len); // FIXME bti.bti_type = BIER_TABLE_MPLS_SPF; @@ -118,6 +119,7 @@ vnet_bier_route_cmd (vlib_main_t * vm, } done: + vec_free(brps); return (error); } @@ -138,6 +140,7 @@ show_bier_fib_command_fn (vlib_main_t * vm, bp = BIER_BP_INVALID; bti = bei = INDEX_INVALID; + flags = BIER_SHOW_BRIEF; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "%d %d", &bti, &bp)) diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c index b74ec337c1f..555196d0092 100644 --- a/src/vnet/fib/fib_test.c +++ b/src/vnet/fib/fib_test.c @@ -612,12 +612,18 @@ fib_test_validate_lb (const dpo_id_t *dpo, va_start(ap, n_buckets); - FIB_TEST_LB((DPO_LOAD_BALANCE == dpo->dpoi_type), - "Entry links to %U", - format_dpo_type, dpo->dpoi_type); - lb = load_balance_get(dpo->dpoi_index); + if (FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type), + "Entry links to %U", + format_dpo_type, dpo->dpoi_type)) + { + lb = load_balance_get(dpo->dpoi_index); - res = fib_test_validate_lb_v(lb, n_buckets, &ap); + res = fib_test_validate_lb_v(lb, n_buckets, &ap); + } + else + { + res = !0; + } va_end(ap); |