From: Victor Julien Date: Thu, 25 Oct 2018 15:02:43 +0000 (+0200) Subject: detect: suppress scan-build warnings X-Git-Tag: suricata-4.1.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00e9fd7a36cb4b84f3c8687c7bb209e068436592;p=thirdparty%2Fsuricata.git detect: suppress scan-build warnings --- diff --git a/src/detect.c b/src/detect.c index f774417883..b83ca708a7 100644 --- a/src/detect.c +++ b/src/detect.c @@ -596,6 +596,8 @@ static inline int DetectRunInspectRuleHeader( * and if so, if we actually have any in the flow. If not, the sig * can't match and we skip it. */ if ((p->flags & PKT_HAS_FLOW) && (sflags & SIG_FLAG_REQUIRE_FLOWVAR)) { + DEBUG_VALIDATE_BUG_ON(f == NULL); + int m = f->flowvar ? 1 : 0; /* no flowvars? skip this sig */ @@ -934,6 +936,8 @@ static DetectRunScratchpad DetectRunSetup( /* grab the protocol state we will detect on */ if (p->flags & PKT_HAS_FLOW) { + DEBUG_VALIDATE_BUG_ON(pflow == NULL); + if (p->flowflags & FLOW_PKT_TOSERVER) { flow_flags = STREAM_TOSERVER; SCLogDebug("flag STREAM_TOSERVER set"); diff --git a/src/util-validate.h b/src/util-validate.h index c0dac20b78..5f23fd75db 100644 --- a/src/util-validate.h +++ b/src/util-validate.h @@ -96,6 +96,13 @@ #define DEBUG_VALIDATE_BUG_ON(exp) BUG_ON((exp)) +#elif defined(__clang_analyzer__) + +#define DEBUG_ASSERT_FLOW_LOCKED(f) +#define DEBUG_VALIDATE_FLOW(f) +#define DEBUG_VALIDATE_PACKET(p) +#define DEBUG_VALIDATE_BUG_ON(exp) BUG_ON((exp)) + #else /* DEBUG_VALIDATE */ #define DEBUG_ASSERT_FLOW_LOCKED(f)