From: Victor Julien Date: Tue, 9 Jan 2024 15:39:22 +0000 (+0100) Subject: detect/threshold: minor code cleanup X-Git-Tag: suricata-8.0.0-beta1~1093 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab5e04525f6999becf1512d9cd48567265a2fb14;p=thirdparty%2Fsuricata.git detect/threshold: minor code cleanup Packet pointer is not used during allocation. --- diff --git a/src/detect-engine-threshold.c b/src/detect-engine-threshold.c index 2203308288..36655983cf 100644 --- a/src/detect-engine-threshold.c +++ b/src/detect-engine-threshold.c @@ -421,9 +421,8 @@ int ThresholdIPPairTimeoutCheck(IPPair *pair, SCTime_t ts) return new_head == NULL; } -static DetectThresholdEntry * -DetectThresholdEntryAlloc(const DetectThresholdData *td, Packet *p, - uint32_t sid, uint32_t gid) +static DetectThresholdEntry *DetectThresholdEntryAlloc( + const DetectThresholdData *td, uint32_t sid, uint32_t gid) { SCEnter(); @@ -701,7 +700,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh, ret = 1; } } else { - *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid); + *new_tsh = DetectThresholdEntryAlloc(td, sid, gid); ret = 1; } @@ -728,7 +727,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh, if (td->count == 1) { ret = 1; } else { - *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid); + *new_tsh = DetectThresholdEntryAlloc(td, sid, gid); } } break; @@ -764,7 +763,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh, } } } else { - *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid); + *new_tsh = DetectThresholdEntryAlloc(td, sid, gid); /* for the first match we return 1 to * indicate we should alert */ @@ -793,7 +792,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh, lookup_tsh->current_count = 1; } } else { - *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid); + *new_tsh = DetectThresholdEntryAlloc(td, sid, gid); } break; } @@ -805,7 +804,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh, if (lookup_tsh && IsThresholdReached(lookup_tsh, td, p->ts)) { RateFilterSetAction(p, pa, td->new_action); } else if (!lookup_tsh) { - *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid); + *new_tsh = DetectThresholdEntryAlloc(td, sid, gid); } break; }