Coverity has flagged the use of a potentially unsafe function.
Although this is not a concern in this case since it's not used for
encryption, we should replace it with the OVS implementation to
achieve better randomness.

Fixes: c72e245a0e2c ("Add InMon's sFlow Agent library to the build system.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/sflow_poller.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/sflow_poller.c b/lib/sflow_poller.c
index 9e6a487bc..46e40cbd4 100644
--- a/lib/sflow_poller.c
+++ b/lib/sflow_poller.c
@@ -6,6 +6,7 @@
  */
 
 #include "sflow_api.h"
+#include "random.h"
 
 /*_________________--------------------------__________________
   _________________    sfl_poller_init       __________________
@@ -88,7 +89,7 @@ void sfl_poller_set_sFlowCpInterval(SFLPoller *poller, 
u_int32_t sFlowCpInterval
           Another smoothing factor is that the tick() function called here is 
usually
           driven from a fairly "soft" polling loop rather than a hard 
real-time event.
        */
-        poller->countersCountdown = 1 + (random() % sFlowCpInterval);
+        poller->countersCountdown = 1 + random_range(sFlowCpInterval);
     }
     else {
         /* Setting sFlowCpInterval to 0 disables counter polling altogether.  
Thanks to
-- 
2.44.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to