]> git.baikalelectronics.ru Git - kernel.git/commit
mlx4_core: Fix integer overflow issues around MTT table
authorYishai Hadas <yishaih@mellanox.com>
Mon, 13 Aug 2012 08:15:07 +0000 (08:15 +0000)
committerRoland Dreier <roland@purestorage.com>
Thu, 16 Aug 2012 04:05:26 +0000 (21:05 -0700)
commitc8556eaff3dc8b89e23d12231f57437726768bbe
tree0f3fd1c557ef4dcb1bb93188c3b585ff4f0b0a44
parent6761f9e8708bef52809ac72f610793caceddd8e2
mlx4_core: Fix integer overflow issues around MTT table

Fix some issues around int variables used in data structures related
to memory registration.

Handle int overflow in mlx4_init_icm_table by using a u64 intermediate
variable and changing struct mlx4_icm_table num_obj field to be u32.

Change some more fields/variables to use u32 instead of int to prevent
a case where the variable becomes negative when bit 31 is set.

Also subtract log_mtts_per_seg from the exponent when computing
num_mtt, since its added later on in that very same code area.

This and the previous commit fixes some issues which actually prevent
commit 746198336e23 ("mlx4_core: Scale size of MTT table with system
RAM") from working.  Now, when the number of MTTs is scaled with the
size of the RAM we can map up to 8TB.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/net/ethernet/mellanox/mlx4/icm.c
drivers/net/ethernet/mellanox/mlx4/icm.h
drivers/net/ethernet/mellanox/mlx4/mlx4.h
drivers/net/ethernet/mellanox/mlx4/mr.c
drivers/net/ethernet/mellanox/mlx4/profile.c