public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port
@ 2015-12-14 10:05 Andrzej Hajda
  2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:05 UTC (permalink / raw)
  To: Or Gerlitz, Jack Morgenstein
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	David S. Miller, Eran Ben Elisha, Hadar Hen Zion, Moni Shoua,
	Yishai Hadas, Maor Gottlieb, netdev, linux-kernel

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

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 5 +++--
 1 file 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 da7f578..b46dbe2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4331,9 +4331,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) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-12-31 13:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
2015-12-14 12:04   ` Winkler, Tomas
2015-12-14 10:06 ` [PATCH] clk: sunxi: fix handling return value of of_property_match_string Andrzej Hajda
2015-12-14 13:05   ` Maxime Ripard
2015-12-14 10:06 ` [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate Andrzej Hajda
2015-12-31 13:12   ` Kalle Valo
2015-12-14 10:06 ` [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq Andrzej Hajda
2015-12-14 10:31   ` Krzysztof Kozlowski
2015-12-14 11:12     ` [PATCH] extcon: max77693: " Andrzej Hajda
2015-12-15  0:22       ` Krzysztof Kozlowski
2015-12-15  1:08       ` Chanwoo Choi
2015-12-15  1:08   ` [PATCH] extcon: max14577: " Chanwoo Choi
2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
2015-12-14 10:30   ` Krzysztof Kozlowski
2015-12-15  1:08   ` Chanwoo Choi
2015-12-14 10:06 ` [PATCH] be2iscsi: fix handling return value of mgmt_open_connection Andrzej Hajda
2015-12-15  9:09 ` [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Or Gerlitz
2015-12-15 16:55   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox