Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity fixes v4 #7173

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/alert-debuglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "util-unittest.h"

#include "util-debug.h"
#include "util-validate.h"
#include "util-buffer.h"

#include "output.h"
Expand Down Expand Up @@ -175,7 +176,8 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da
if (PKT_IS_IPV4(p)) {
PrintInet(AF_INET, (const void *)GET_IPV4_SRC_ADDR_PTR(p), srcip, sizeof(srcip));
PrintInet(AF_INET, (const void *)GET_IPV4_DST_ADDR_PTR(p), dstip, sizeof(dstip));
} else if (PKT_IS_IPV6(p)) {
} else {
DEBUG_VALIDATE_BUG_ON(!(PKT_IS_IPV6(p)));
PrintInet(AF_INET6, (const void *)GET_IPV6_SRC_ADDR(p), srcip, sizeof(srcip));
PrintInet(AF_INET6, (const void *)GET_IPV6_DST_ADDR(p), dstip, sizeof(dstip));
}
Expand Down
4 changes: 0 additions & 4 deletions src/detect-xbits.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ static int DetectXbitMatchIPPair(Packet *p, const DetectXbitsData *xd)
return DetectIPPairbitMatchUnset(p,xd);
case DETECT_XBITS_CMD_TOGGLE:
return DetectIPPairbitMatchToggle(p,xd);
default:
SCLogError(SC_ERR_UNKNOWN_VALUE, "unknown cmd %" PRIu32 "", xd->cmd);
return 0;
}
return 0;
}
Expand Down Expand Up @@ -304,7 +301,6 @@ static int DetectXbitParse(DetectEngineCtx *de_ctx,
case DETECT_XBITS_CMD_SET:
case DETECT_XBITS_CMD_UNSET:
case DETECT_XBITS_CMD_TOGGLE:
default:
if (strlen(fb_name) == 0)
return -1;
break;
Expand Down
7 changes: 5 additions & 2 deletions src/flow-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,11 @@ static Flow *TcpReuseReplace(ThreadVars *tv, FlowLookupStruct *fls,
/* get some settings that we move over to the new flow */
FlowThreadId thread_id[2] = { old_f->thread_id[0], old_f->thread_id[1] };

/* since fb lock is still held this flow won't be found until we are done */
FLOWLOCK_UNLOCK(old_f);
// if old_f->use_cnt == 0, flow will be unlocked by caller with MoveToWorkQueue
if (old_f->use_cnt > 0) {
/* since fb lock is still held this flow won't be found until we are done */
FLOWLOCK_UNLOCK(old_f);
}

/* Get a new flow. It will be either a locked flow or NULL */
Flow *f = FlowGetNew(tv, fls, p);
Expand Down
2 changes: 1 addition & 1 deletion src/tmqh-packetpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void PacketPoolDestroy(void)
PktPool *my_pool = GetThreadPacketPool();

#ifdef DEBUG_VALIDATION
BUG_ON(my_pool->destroyed);
BUG_ON(my_pool && my_pool->destroyed);
#endif /* DEBUG_VALIDATION */

if (my_pool && my_pool->pending_pool != NULL) {
Expand Down