Skip to content

Commit

Permalink
Merge pull request #6808 from ton31337/fix/dampening_reuse_limit_assert
Browse files Browse the repository at this point in the history
bgpd: Bypass SA tests regarding division by zero for reuse_limit in dampening
  • Loading branch information
riw777 committed Jul 28, 2020
2 parents 9034306 + 3ec5c50 commit 4f08132
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bgpd/bgp_damp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4f08132

Please sign in to comment.