diff mbox series

[ovs-dev,v2,4/8] sflow: Use uint32_t instead of time_t for tick handling in the poller.

Message ID 412d6cdbaf675ad149838a0d6bf4874505197503.1716896375.git.echaudro@redhat.com
State Changes Requested
Headers show
Series Coverity fixes. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Eelco Chaudron May 28, 2024, 11:39 a.m. UTC
The sFlow library uses a uint32_t to configure timeout ticks, but
stores this value as a time_t. Although this doesn't cause functional
issues, it wastes space and confuses Coverity, potentially indicating
a Y2K38 problem when storing uint32_t values in time_t. This patch
updates the internal data structures to use uint32_t variables.

Fixes: c72e245a0e2c ("Add InMon's sFlow Agent library to the build system.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/sflow_api.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mike Pattrick May 28, 2024, 5:37 p.m. UTC | #1
On Tue, May 28, 2024 at 7:46 AM Eelco Chaudron <echaudro@redhat.com> wrote:
>
> The sFlow library uses a uint32_t to configure timeout ticks, but
> stores this value as a time_t. Although this doesn't cause functional
> issues, it wastes space and confuses Coverity, potentially indicating
> a Y2K38 problem when storing uint32_t values in time_t. This patch
> updates the internal data structures to use uint32_t variables.
>
> Fixes: c72e245a0e2c ("Add InMon's sFlow Agent library to the build system.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---

Acked-by: Mike Pattrick <mkp@redhat.com>
diff mbox series

Patch

diff --git a/lib/sflow_api.h b/lib/sflow_api.h
index eb23e2acd..f4bfa5ead 100644
--- a/lib/sflow_api.h
+++ b/lib/sflow_api.h
@@ -148,7 +148,7 @@  typedef struct _SFLPoller {
     /* MIB fields */
     SFLDataSource_instance dsi;
     u_int32_t sFlowCpReceiver;
-    time_t sFlowCpInterval;
+    u_int32_t sFlowCpInterval;
     /* public fields */
     struct _SFLAgent *agent; /* pointer to my agent */
     void *magic;             /* ptr to pass back in getCountersFn() */
@@ -156,7 +156,7 @@  typedef struct _SFLPoller {
     u_int32_t bridgePort; /* port number local to bridge */
     /* private fields */
     SFLReceiver *myReceiver;
-    time_t countersCountdown;
+    u_int32_t countersCountdown;
     u_int32_t countersSampleSeqNo;
 } SFLPoller;