Message ID | 6e8eafb47ae8006dd57bcf5156c0c69e7d0cd911.1716896375.git.echaudro@redhat.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Coverity fixes. | expand |
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 |
On Tue, May 28, 2024 at 7:46 AM Eelco Chaudron <echaudro@redhat.com> wrote: > > 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 <echaudro@redhat.com> Acked-by: Mike Pattrick <mkp@redhat.com>
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
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 <echaudro@redhat.com> --- lib/sflow_poller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)