]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Avoid possibility of division by zero
authorRyan Moeller <freqlabs@FreeBSD.org>
Tue, 8 Sep 2020 18:39:16 +0000 (14:39 -0400)
committerGitHub <noreply@github.com>
Tue, 8 Sep 2020 18:39:16 +0000 (11:39 -0700)
commitebc4b52369ea10a2ad3df03b679acdd077e45a48
tree6c8edb64248be4458980ab4b47d8b0c6a0f6e407
parent189272f78a775e3ef93499c21c8742c39ab36322
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
include/os/freebsd/zfs/sys/zfs_context_os.h
include/sys/zfs_context.h