summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2015-12-14 11:05:58 +0100
committerDavid S. Miller <davem@davemloft.net>2015-12-15 11:54:43 -0500
commit2b2b31c845d3dec6f9960db92d0993ddfc2d2b7f (patch)
tree0cbb3d3e54f22b961f737954f80a9f99766121e5 /drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
parentf654861569872d10dcb79d9d7ca219b316f94ff0 (diff)
downloadlinux-2b2b31c845d3dec6f9960db92d0993ddfc2d2b7f.tar.gz
linux-2b2b31c845d3dec6f9960db92d0993ddfc2d2b7f.tar.bz2
linux-2b2b31c845d3dec6f9960db92d0993ddfc2d2b7f.zip
net/mlx4_core: fix handling return value of mlx4_slave_convert_port
The function can return negative values, so its result should be assigned to signed variable. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Fixes: fc48866f7 ('net/mlx4: Adapt code for N-Port VF') Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/resource_tracker.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 6fec3e993d02..cad6c44df91c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4306,9 +4306,10 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
return -EOPNOTSUPP;
ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf;
- ctrl->port = mlx4_slave_convert_port(dev, slave, ctrl->port);
- if (ctrl->port <= 0)
+ err = mlx4_slave_convert_port(dev, slave, ctrl->port);
+ if (err <= 0)
return -EINVAL;
+ ctrl->port = err;
qpn = be32_to_cpu(ctrl->qpn) & 0xffffff;
err = get_res(dev, slave, qpn, RES_QP, &rqp);
if (err) {