summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/node.c
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2022-08-23 15:48:59 +0000
committerDamjan Marion <dmarion@0xa5.net>2022-08-30 14:41:51 +0000
commit76b8aa00f73390aba91d075125c51b4af6c48ebb (patch)
tree8ce4bad3df525afda4f7756c296c47f707b787fc /src/vnet/ethernet/node.c
parent618afb5fb0c1171e4e6bf5bfd642a6050b21ce4f (diff)
ethernet: fix coverity 214973
Ensure that the ethernet_input_inline_dmac_check which directly derefererences ei, is called only if ei is set. Type: fix Change-Id: I2d3bce63ee457825a5d375a6102225f3abf67703 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/vnet/ethernet/node.c')
-rw-r--r--src/vnet/ethernet/node.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index c1a8e0d4ce6..4ef575a85fc 100644
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -1563,21 +1563,20 @@ ethernet_input_inline (vlib_main_t * vm,
dmacs[0] = *(u64 *) e0;
- if (ei && vec_len (ei->secondary_addrs))
- ethernet_input_inline_dmac_check (hi, dmacs,
- dmacs_bad,
- 1 /* n_packets */ ,
- ei,
- 1 /* have_sec_dmac */ );
- else
- ethernet_input_inline_dmac_check (hi, dmacs,
- dmacs_bad,
- 1 /* n_packets */ ,
- ei,
- 0 /* have_sec_dmac */ );
-
- if (dmacs_bad[0])
- error0 = ETHERNET_ERROR_L3_MAC_MISMATCH;
+ if (ei)
+ {
+ if (vec_len (ei->secondary_addrs))
+ ethernet_input_inline_dmac_check (
+ hi, dmacs, dmacs_bad, 1 /* n_packets */, ei,
+ 1 /* have_sec_dmac */);
+ else
+ ethernet_input_inline_dmac_check (
+ hi, dmacs, dmacs_bad, 1 /* n_packets */, ei,
+ 0 /* have_sec_dmac */);
+
+ if (dmacs_bad[0])
+ error0 = ETHERNET_ERROR_L3_MAC_MISMATCH;
+ }
skip_dmac_check0:
vlib_buffer_advance (b0, sizeof (ethernet_header_t));