HomeFreeBSD

Avoid possibility of division by zero

Description

Avoid possibility of division by zero

When hz > 1000, msec / (1000 / hz) results in division by zero.

I found somewhere in FreeBSD using howmany(msec * hz, 1000) to convert
ms to ticks, avoiding the potential for a zero in the divisor.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #10894

Details

Provenance
freqlabsAuthored on Sep 8 2020, 6:39 PM
GitHub <noreply@github.com>Committed on Sep 8 2020, 6:39 PM
Parents
rG189272f78a77: dnode_special_open() error: unchecked function return 'zrl_tryenter'
Branches
Unknown
Tags
Unknown