OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_0-96-gbf37aec

Gerrit Code Review gerrit@openafs.org
Fri, 22 Jan 2021 19:52:33 -0500


The following commit has been merged in the master branch:
commit bf37aec672efaf7824d9c96bcff7a45eb47ef280
Author: Cheyenne Wills <cwills@sinenomine.net>
Date:   Fri Jan 22 12:48:21 2021 -0700

    tests: fix potential divide by zero condition
    
    Running clang's static analysis revealed a possible divide by zero
    condition.
    
    There is a random chance of the divide by zero.
    
    - it has to be in the first pass of the main loop testing events
      (counter = 0)
    - 90% chance path :   if (counter < (NUMEVENTS -1) &&
                              random() % 10 == 0)      -- needs to be false
    - 25% chance path:    if (random() % 4 == 0)       -- needs to be true
    
    if the above conditions are met, the statement
        int victim = random() % counter
    is a divide by zero.
    
    Add a check to ensure the counter is greater than zero.  Add a comment
    to document that only events prior to the current event are randomly
    selected.
    
    Change-Id: I4b4e73fa324842bb504bcc952079af15aea8a6a3
    Reviewed-on: https://gerrit.openafs.org/14501
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

 tests/rx/event-t.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

-- 
OpenAFS Master Repository