ethernet: fix coverity 218549 98/36998/4
authorAndrew Yourtchenko <ayourtch@gmail.com>
Tue, 23 Aug 2022 15:38:05 +0000 (15:38 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Mon, 29 Aug 2022 21:20:58 +0000 (21:20 +0000)
Check that the pointer is non-null before dereferencing it.

Type: fix
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I611a1042d08bbe455dd09a4fa5711fe86c440240

src/vnet/ethernet/node.c

index 214e688..21346a8 100644 (file)
@@ -225,7 +225,7 @@ identify_subint (ethernet_main_t * em,
       // A unicast packet arriving on an L3 interface must have a dmac
       // matching the interface mac. If interface has STATUS_L3 bit set
       // mac filter is already done.
-      if (!(*is_l2 || (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)))
+      if (!(*is_l2 || (ei && (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3))))
        {
          u64 dmacs[2];
          u8 dmacs_bad[2];