]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
af-packet: use BUG_ON for 'impossible' condition
authorVictor Julien <victor@inliniac.net>
Thu, 4 Nov 2021 09:05:54 +0000 (10:05 +0100)
committerVictor Julien <vjulien@oisf.net>
Mon, 22 Nov 2021 12:56:07 +0000 (13:56 +0100)
src/source-af-packet.c

index aeb9e4bae0fa39fb9ea2996094b45fdf6f5075f3..44fe327cd38dc317b06c598a078e649f7037dca6 100644 (file)
@@ -683,11 +683,11 @@ static void AFPReleaseDataFromRing(Packet *p)
         AFPWritePacket(p, TPACKET_V2);
     }
 
-    if (p->afp_v.relptr) {
-        union thdr h;
-        h.raw = p->afp_v.relptr;
-        h.h2->tp_status = TP_STATUS_KERNEL;
-    }
+    BUG_ON(p->afp_v.relptr == NULL);
+
+    union thdr h;
+    h.raw = p->afp_v.relptr;
+    h.h2->tp_status = TP_STATUS_KERNEL;
 
     (void)AFPDerefSocket(p->afp_v.mpeer);