From 462eb7b80251d8704de201c88f7f5294b0b4e822 Mon Sep 17 00:00:00 2001 From: Yishai Hadas Date: Mon, 22 Apr 2013 14:36:43 +0300 Subject: [PATCH] mlx4_core: sysfs, fix usage of log_num_mtt module parameter When was auto calculated based on RAM size it wrongly includes also log_mtts_per_seg. It's wrong in 2 ways: First, log_mtts_per_seg should be added by the application itself, no reason to a have total in log_num_mtt itself. Second, in case that an extra NIC exists it may get an invalid value as it depends on a larger value. Specifically, it may cause an overflow and later leads on to kernel panic via mlx4_buddy_init. Signed-off-by: Yishai Hadas (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- drivers/net/ethernet/mellanox/mlx4/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 7b723b9ed299..cd70f679facc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -245,7 +245,7 @@ static void process_mod_param_profile(struct mlx4_profile *profile) >> log_mtts_per_seg))); /* set the actual value, so it will be reflected to the user using the sysfs */ - mod_param_profile.num_mtt = ilog2(profile->num_mtt * (1 << log_mtts_per_seg)); + mod_param_profile.num_mtt = ilog2(profile->num_mtt); } } -- 2.50.1