OSDN Git Service

net/mlx4_en: Fix type mismatch for 32-bit systems
authorSlava Shwartsman <slavash@mellanox.com>
Thu, 29 Dec 2016 16:37:12 +0000 (18:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Dec 2017 21:01:49 +0000 (22:01 +0100)
commit55c050ae5165bbeff669aaf32c7ed4dfc8f513b4
tree09bc054f895b97c66b457c91acd056375df88663
parent771c831c1bdef159ff6fa01a6c49f0890b1f3066
net/mlx4_en: Fix type mismatch for 32-bit systems

[ Upstream commit 61b6034c6cfdcb265bb453505c3d688e7567727a ]

is_power_of_2 expects unsigned long and we pass u64 max_val_cycles,
this will be truncated on 32 bit systems, and the result is not what we
were expecting.
div_u64 expects u32 as a second argument and we pass
max_val_cycles_rounded which is u64 hence it will always be truncated.
Fix was tested on both 64 and 32 bit systems and got same results for
max_val_cycles and max_val_cycles_rounded.

Fixes: 4850cf458157 ("net/mlx4_en: Resolve dividing by zero in 32-bit system")
Signed-off-by: Slava Shwartsman <slavash@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx4/en_clock.c