From dda50af13bea3adccd1ef8c43f35d78862fe0a12 Mon Sep 17 00:00:00 2001 From: Shivshankar-Reddy Date: Thu, 19 Sep 2024 22:10:15 +0000 Subject: [PATCH] make aeTimeProc function return value to long long to avoid overflow Signed-off-by: Shivshankar-Reddy --- src/ae.c | 2 +- src/ae.h | 2 +- src/evict.c | 2 +- src/module.c | 2 +- src/rdma.c | 2 +- src/server.c | 2 +- src/valkey-benchmark.c | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ae.c b/src/ae.c index ef7ba7bd67..57f1caa535 100644 --- a/src/ae.c +++ b/src/ae.c @@ -363,7 +363,7 @@ static int processTimeEvents(aeEventLoop *eventLoop) { } if (te->when <= now) { - int retval; + long long retval; id = te->id; te->refcount++; diff --git a/src/ae.h b/src/ae.h index 1156819c9c..28c41422b2 100644 --- a/src/ae.h +++ b/src/ae.h @@ -68,7 +68,7 @@ struct aeEventLoop; /* Types and data structures */ typedef void aeFileProc(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask); -typedef int aeTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData); +typedef long long aeTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData); typedef void aeEventFinalizerProc(struct aeEventLoop *eventLoop, void *clientData); typedef void aeBeforeSleepProc(struct aeEventLoop *eventLoop); typedef void aeAfterSleepProc(struct aeEventLoop *eventLoop, int numevents); diff --git a/src/evict.c b/src/evict.c index 4b9f70eaa5..5e4b6220eb 100644 --- a/src/evict.c +++ b/src/evict.c @@ -447,7 +447,7 @@ int overMaxmemoryAfterAlloc(size_t moremem) { * eviction cycles until the "maxmemory" condition has resolved or there are no * more evictable items. */ static int isEvictionProcRunning = 0; -static int evictionTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData) { +static long long evictionTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData) { UNUSED(eventLoop); UNUSED(id); UNUSED(clientData); diff --git a/src/module.c b/src/module.c index 24cc6a42e7..41993fcc53 100644 --- a/src/module.c +++ b/src/module.c @@ -9114,7 +9114,7 @@ typedef struct ValkeyModuleTimer { /* This is the timer handler that is called by the main event loop. We schedule * this timer to be called when the nearest of our module timers will expire. */ -int moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *clientData) { +long long moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *clientData) { UNUSED(eventLoop); UNUSED(id); UNUSED(clientData); diff --git a/src/rdma.c b/src/rdma.c index bca01b9839..66dd0dd6fc 100644 --- a/src/rdma.c +++ b/src/rdma.c @@ -672,7 +672,7 @@ static void connRdmaEventHandler(struct aeEventLoop *el, int fd, void *clientDat } } -static int rdmaKeepaliveTimeProc(struct aeEventLoop *el, long long id, void *clientData) { +static long long rdmaKeepaliveTimeProc(struct aeEventLoop *el, long long id, void *clientData) { struct rdma_cm_id *cm_id = clientData; RdmaContext *ctx = cm_id->context; connection *conn = ctx->conn; diff --git a/src/server.c b/src/server.c index 6a2d46d974..02b4c4a6a2 100644 --- a/src/server.c +++ b/src/server.c @@ -1257,7 +1257,7 @@ void cronUpdateMemoryStats(void) { * a macro is used: run_with_period(milliseconds) { .... } */ -int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { +long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { int j; UNUSED(eventLoop); UNUSED(id); diff --git a/src/valkey-benchmark.c b/src/valkey-benchmark.c index 3cc82148f0..44ac8e7905 100644 --- a/src/valkey-benchmark.c +++ b/src/valkey-benchmark.c @@ -195,7 +195,7 @@ static redisContext *getRedisContext(const char *ip, int port, const char *hosts static void freeServerConfig(serverConfig *cfg); static int fetchClusterSlotsConfiguration(client c); static void updateClusterSlotsConfiguration(void); -int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData); +static long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData); /* Dict callbacks */ static uint64_t dictSdsHash(const void *key); @@ -1607,7 +1607,7 @@ tls_usage, exit(exit_status); } -int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) { +long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) { UNUSED(eventLoop); UNUSED(id); benchmarkThread *thread = (benchmarkThread *)clientData;