net/mlx4_core: Make sure that negative array index isn't used
authorDotan Barak <dotanb@dev.mellanox.co.il>
Wed, 16 Jul 2014 08:57:48 +0000 (11:57 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jul 2014 06:26:24 +0000 (23:26 -0700)
commitaab2bb0e290bc4f99992cb2198c40eb645647548
tree6d467bc93c9ab39394242af2b1fe79c308125b50
parent0d7869acb2f30b64e4fb782b5df309e2287c2e1f
net/mlx4_core: Make sure that negative array index isn't used

To make sure that the array index isn't used in the code with
negative value, we stop using the for loop integer iterator
outside of it.
>From now on use members count to swap the last QP with removed one.
Fix also the second occurrence of this flow in mlx4_qp_detach_common().
In mlx4_qp_detach_common() use members_count instead of
loop iterator outside of the for loop.

Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Reviewed-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/mcg.c