[Snort-devel] snort 2.9.11 warnings with clang/llvm on OpenBSD 6.2

Markus Lude markus.lude at gmx.de
Fri Oct 20 16:46:28 EDT 2017


Hello,

while building snort 2.9.11 with clang/llvm 4.0.0 I get a lot of
warnings.

build was done on OpenBSD 6.2 on i386

timeval vs. bpf_timeval problem is OpenBSD-related.

Regards
Markus


warning messages (build log available on request):

/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/acsmx.c:825:11: warning: explicitly assigning value of variable of type 'ACSM_STRUCT *' to itself [-Wself-assign]
        p = p;
        ~ ^ ~
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/sfksearch.c:958:5: warning: unused function 'KTrieSearchQBC' [-Wunused-function]
int KTrieSearchQBC( KTRIE_STRUCT * ks, unsigned char * T, int n,
    ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/sfportobject.c:219:7: warning: explicitly assigning value of variable of type 'size_t' (aka 'unsigned long') to itself [-Wself-assign]
    n = n;
    ~ ^ ~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/sfportobject.c:284:7: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
    n = n;  /* To silence a Win32 warning */
    ~ ^ ~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/sfportobject.c:328:7: warning: explicitly assigning value of variable of type 'size_t' (aka 'unsigned long') to itself [-Wself-assign]
    n = n;  /* To silence a Win32 warning */
    ~ ^ ~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfutil/sfportobject.c:1786:7: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
    n = n; /* This quiets a Win32 warning */
    ~ ^ ~
4 warnings generated.

if this is "needed" for strange win32 compilers maybe put that in #ifdefs?


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/detection-plugins/sp_respond3.c:206:10: warning: variable 'num_toks' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    if ( type )
         ^~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/detection-plugins/sp_respond3.c:213:16: note: uninitialized use occurs here
    while (i < num_toks)
               ^~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/detection-plugins/sp_respond3.c:206:5: note: remove the 'if' if its condition is always true
    if ( type )
    ^~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/detection-plugins/sp_respond3.c:204:17: note: initialize the variable 'num_toks' to silence this warning
    int num_toks, i;
                ^
                 = 0
1 warning generated.


In file included from /usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-plug
ins/sf_dynamic_plugins.c:98:
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/reload.h:78:21: warning: format specifies type 'unsigned long' but the argument has type 'long long' [-Wformat]
                    (adjust_started_at.tv_sec * 1000 + adjust_started_at.tv_usec / 1000));
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/reload.h:91:21: warning: format specifies type 'unsigned long' but the argument has type 'long long' [-Wformat]
                    ((curr_time.tv_sec * 1000 + curr_time.tv_usec / 1000) - (adjust_started_at.tv_sec * 1000 + adjust_started_at.tv_usec / 1000)) );
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:6390:26: warning: incompatible pointer types passing 'const struct bpf_timeval *' to parameter of type 'const struct timeval *' [-Wincompatible-pointer-types]
    ss = SegmentAlloc(p, &p->pkth->ts, p->pkth->caplen, p->pkth->pktlen, p->pkt);
                         ^~~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:6278:42: note: passing argument to parameter 'tv' here
        Packet* p, const struct timeval* tv, uint32_t caplen, uint32_t pktlen, const uint8_t* pkt)
                                         ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:1226:29: warning: unused function 'StreamTCPCreateSession' [-Wunused-function]
static SessionControlBlock *StreamTCPCreateSession( const SessionKey *key )
                            ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:1234:13: warning: unused function 'StreamTCPDeactivateSession' [-Wunused-function]
static void StreamTCPDeactivateSession( SessionControlBlock *scb )
            ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:1248:12: warning: unused function 'StreamTCPDeleteSession' [-Wunused-function]
static int StreamTCPDeleteSession( const SessionKey *key )
           ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_tcp.c:6205:30: warning: unused function 'FindSegment' [-Wunused-function]
static inline StreamSegment *FindSegment(StreamTracker *st, uint32_t pkt_seq)
                             ^
5 warnings generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/Stream6/snort_stream_ip.c:347:19: warning: unused function 'CheckExpectedSession' [-Wunused-function]
static inline int CheckExpectedSession (Packet* p, SessionControlBlock *scb)
                  ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/spp_sfportscan.c:1602:15: warning: unused variable 'old_logfile' [-Wunused-variable]
        char *old_logfile = ((PortscanConfig *)sfPolicyUserDataGetDefault(portscan_config))->logfile;
              ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/spp_frag3.c:2133:20: warning: unused function 'FragEvent' [-Wunused-function]
static inline void FragEvent(Packet *p, int gid, char *str,
                   ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/preprocessors/spp_session.c:3845:13: warning: unused function 'verifyConfigOptionUnchanged' [-Wunused-function]
static bool verifyConfigOptionUnchanged( uint32_t new, uint32_t old, char *name, SessionConfiguration *config )
            ^


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2
_config.c:967:20: warning: unused function 'DCE2_GcClearEvent' [-Wunused-functio
n]
static inline void DCE2_GcClearEvent(DCE2_GlobalConfig *gc, DCE2_EventFlag eflag
)
                   ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2
_config.c:2933:20: warning: unused function 'DCE2_ScClearValidSmbVersion' [-Wunu
sed-function]
static inline void DCE2_ScClearValidSmbVersion(DCE2_ServerConfig *sc,
                   ^
2 warnings generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/spp_dce2.c:1321:30: warning: implicit conversion from 'int' to 'uint8_t' (aka 'unsigned char') changes value from 512 to 0 [-Wconstant-conversion]
    uint8_t maxWork = idle ? 512 : 32;
            ~~~~~~~          ^~~
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2
_smb.c:130:20: warning: unused function 'DCE2_ComInfoIsCommandOK' [-Wunused-func
tion]
static inline bool DCE2_ComInfoIsCommandOK(const DCE2_SmbComInfo *com_info)
                   ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2_smb.c:145:20: warning: unused function 'DCE2_ComInfoIsInvalidByteCount' [-Wunused-function]
static inline bool DCE2_ComInfoIsInvalidByteCount(const DCE2_SmbComInfo *com_info)
                   ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2_smb.c:8035:20: warning: unused function 'DCE2_SmbEmptyTmpFileTrackerQueue' [-Wunused-function]
static inline void DCE2_SmbEmptyTmpFileTrackerQueue(DCE2_SmbRequestTracker *rtracker)
                   ^
3 warnings generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2
_smb2.c:148:23: warning: unused function 'DCE2_Smb2ShareType' [-Wunused-function
]
static inline uint8_t DCE2_Smb2ShareType(DCE2_SmbSsnData *ssd, const uint32_t ti
d)
                      ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/dcerpc2/dce2
_co.c:1846:20: warning: unused function 'DCE2_CoSegReassemble' [-Wunused-function]
static inline void DCE2_CoSegReassemble(DCE2_SsnData *sd, DCE2_CoTracker *cot)
                   ^
1 warning generated.
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/sdf/spp_sdf.
c:904:30: warning: unused function 'in_chksum_ip' [-Wunused-function]
static inline unsigned short in_chksum_ip(  const unsigned short * w, int blen )
                             ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/reputation/reputation_config.c:556:13: warning: variable 'list_ptr' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
        if (config->iplist == NULL ||
            ^~~~~~~~~~~~~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/reputation/reputation_config.c:561:37: note: uninitialized use occurs here
        config->iplist->list_info = list_ptr;
                                    ^~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/reputation/reputation_config.c:556:13: note: remove the '||' if its condition is always false
        if (config->iplist == NULL ||
            ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/dynamic-preprocessors/reputation/reputation_config.c:535:24: note: initialize the variable 'list_ptr' to silence this warning
    MEM_OFFSET list_ptr;
                       ^
                        = 0
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/encode.c:65:19: warning: unused function 'IsIcmp' [-Wunused-function]
static inline int IsIcmp (int type)
                  ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/snort.c:1592:24: warning: incompatible pointer types passing 'const struct bpf_timeval *' to parameter of type 'const struct timeval *' [-Wincompatible-pointer-types]
    packet_time_update(&pkthdr->ts);
                       ^~~~~~~~~~~
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/packet_time.h:34:47: note: passing argument to parameter 'cur_tv' here
void packet_time_update(const struct timeval *cur_tv);
                                              ^
/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/snort.c:4233:14: warning: address of array 'sc->event_queue' will always evaluate to 'true' [-Wpointer-bool-conversion]
    if ( sc->event_queue )
    ~~   ~~~~^~~~~~~~~~~
2 warnings generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/src/sfdaq.c:79:23: warning: unused function 'Read_test' [-Wunused-function]
static inline ssize_t Read_test(int fd, void *buf, size_t count)
                      ^
1 warning generated.


/usr/ports/pobj/snort-2.9.11/snort-2.9.11/tools/u2spewfoo/u2spewfoo.c:686:20: warning: unused function 'print_uuid' [-Wunused-function]
static inline void print_uuid (const char* label, uint8_t* data)
                   ^
1 warning generated.




More information about the Snort-devel mailing list