• Paul E. McKenney's avatar
    refscale: Bounds-check module parameters · 0c6d18d8
    Paul E. McKenney authored
    The default value for refscale.nreaders is -1, which results in the code
    setting the value to three-quarters of the number of CPUs.  On single-CPU
    systems, this results in three-quarters of the value one, which the C
    language's integer arithmetic rounds to zero.  This in turn results in
    a divide-by-zero error.
    
    This commit therefore adds bounds checking to the refscale module
    parameters, so that if they are less than one, they are set to the
    value one.
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Tested-by "Chen, Rong A" <rong.a.chen@intel.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    0c6d18d8
refscale.c 16.9 KB