]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Dec 2016 19:17:40 +0000 (14:17 -0500)
commit12a8d825785352ef2e3179f76d84252457e61913
treec85c3a5f272ea394e7e507d5bd77c8a83f0186bb
parent4ced989413a64776181596103a47bef1991c14ca
net/mlx4_en: Fix type mismatch for 32-bit systems

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: 9b9fb1552f93 ("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>
drivers/net/ethernet/mellanox/mlx4/en_clock.c