Coverity reported about two division by zero:
*** CID 350344: Incorrect expression (DIVIDE_BY_ZERO)
Although in fact these dividers will never be equal to 0,
adding explicit checks in lookup() to make coverity happy
will not affect the execution speed.
Fixes:
908be0651a5a ("app/test-sad: add test application for IPsec SAD")
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
uint32_t burst_sz;
struct rte_ipsec_sad *sad = arg;
+ if (config.nb_tuples == 0)
+ return 0;
+
burst_sz = RTE_MIN(config.burst_sz, config.nb_tuples);
for (i = 0; i < config.nb_tuples; i += burst_sz) {
for (j = 0; j < burst_sz; j++)
print_result(keys[j], vals[j]);
}
}
+ acc = (acc == 0) ? UINT64_MAX : acc;
printf("Average lookup cycles %.2Lf, lookups/sec: %.2Lf\n",
(long double)acc / config.nb_tuples,
(long double)config.nb_tuples * rte_get_tsc_hz() / acc);