Whamcloud - gitweb
LU-9116 libcfs: avoid overflow of crypto bandwidth caculation 36/25436/4
authorGu Zheng <gzheng@ddn.com>
Tue, 14 Feb 2017 03:26:11 +0000 (11:26 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 1 Mar 2017 05:12:17 +0000 (05:12 +0000)
commit0c8d53e17be600c99e4a8f96062f39306c3ccad8
tree80d2a97f7c3cd2b4c14b7fe33eff94889dcd8575
parent592bb85e208b3a552176f2be1bb06ec3d78e0eed
LU-9116 libcfs: avoid overflow of crypto bandwidth caculation

bcount and buf_len are both int, and no force convert in the caculation code:
tmp = ((bcount * buf_len / jiffies_to_msecs(end - start)) *
1000) / (1024 * 1024);
That may cause overflow in modern fast machine.

Change-Id: I1e5abccad3e4df62907317a09de02beb6d831e13
Signed-off-by: Gu Zheng <gzheng@ddn.com>
Reviewed-on: https://review.whamcloud.com/25436
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Li Xi <lixi@ddn.com>
libcfs/libcfs/linux/linux-crypto.c