From 3ec5c50019a6b010897fb488da61aa0da28f5f1c Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Mon, 27 Jul 2020 20:38:42 +0300 Subject: [PATCH] bgpd: Bypass SA tests regarding division by zero for reuse_limit in dampening reuse_limit can't be zero basically, Coverity just does not know how the value comes in. Signed-off-by: Donatas Abraitis --- bgpd/bgp_damp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 97d625493f..565d0b8e19 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -50,6 +50,12 @@ static int bgp_reuse_index(int penalty, struct bgp_damp_config *bdc) unsigned int i; int index; + /* + * reuse_limit can't be zero, this is for Coverity + * to bypass division by zero test. + */ + assert(bdc->reuse_limit); + i = (int)(((double)penalty / bdc->reuse_limit - 1.0) * bdc->scale_factor); -- 2.39.5