net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Wed, 30 May 2012 09:14:54 +0000 (09:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 May 2012 22:18:16 +0000 (18:18 -0400)
commit6230bb234dd17b4c92518e848368ce03f9802323
tree4cad586a9fbed1568a687fe5aa67124f11b3cf98
parentb91cb3ebcd5ef8db956b8caa486d780dc52b07f1
net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap

The range check was performed after using the port number.

Reverse this to prevent a potential array overflow.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c