From: Victor Julien Date: Thu, 4 Nov 2021 09:05:54 +0000 (+0100) Subject: af-packet: use BUG_ON for 'impossible' condition X-Git-Tag: suricata-7.0.0-beta1~1167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f79f452ad6762f8cc15291362c681be2da153d8;p=thirdparty%2Fsuricata.git af-packet: use BUG_ON for 'impossible' condition --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index aeb9e4bae0..44fe327cd3 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -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);