defrag: fix -Wshorten-64-to-32 warnings

Ticket: #6186
pull/11524/head
Philippe Antoine 1 year ago
parent bb9a45cfd0
commit ce2c087e92

@ -124,7 +124,7 @@ static void DefragParseParameters(ConfNode *n)
}
}
void DefragSetDefaultTimeout(intmax_t timeout)
void DefragSetDefaultTimeout(int timeout)
{
default_timeout = timeout;
SCLogDebug("default timeout %d", default_timeout);

@ -27,7 +27,7 @@
#include "decode.h"
void DefragSetDefaultTimeout(intmax_t timeout);
void DefragSetDefaultTimeout(int timeout);
void DefragPolicyLoadFromConfig(void);
int DefragPolicyGetHostTimeout(Packet *p);
void DefragTreeDestroy(void);

@ -168,13 +168,13 @@ DefragContextNew(void)
/* Initialize the pool of frags. */
intmax_t frag_pool_size;
if (!ConfGetInt("defrag.max-frags", &frag_pool_size) || frag_pool_size == 0) {
if (!ConfGetInt("defrag.max-frags", &frag_pool_size) || frag_pool_size == 0 ||
frag_pool_size > UINT32_MAX) {
frag_pool_size = DEFAULT_DEFRAG_POOL_SIZE;
}
intmax_t frag_pool_prealloc = frag_pool_size / 2;
dc->frag_pool = PoolInit(frag_pool_size, frag_pool_prealloc,
sizeof(Frag),
NULL, DefragFragInit, dc, NULL, NULL);
uint32_t frag_pool_prealloc = (uint32_t)frag_pool_size / 2;
dc->frag_pool = PoolInit((uint32_t)frag_pool_size, frag_pool_prealloc, sizeof(Frag), NULL,
DefragFragInit, dc, NULL, NULL);
if (dc->frag_pool == NULL) {
FatalError("Defrag: Failed to initialize fragment pool.");
}
@ -194,7 +194,7 @@ DefragContextNew(void)
else if (timeout > TIMEOUT_MAX) {
FatalError("defrag: Timeout greater than maximum allowed value.");
}
dc->timeout = timeout;
dc->timeout = (uint32_t)timeout;
}
SCLogDebug("Defrag Initialized:");

@ -37,7 +37,7 @@ typedef struct DefragContext_ {
Pool *frag_pool; /**< Pool of fragments. */
SCMutex frag_pool_lock;
time_t timeout; /**< Default timeout. */
uint32_t timeout; /**< Default timeout. */
} DefragContext;
/**

Loading…
Cancel
Save