Skip to contentSkip to conversation

mlx4_en: fix allocation of device tx_cq

PATCH Applied Kleber Sacilotto de Souza 3 participants 3 messages Feb 23, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4_en: fix allocation of device tx_cq

The memory to hold the network device tx_cq is not being allocated with the correct size in mlx4_en_init_netdev(). It should use MAX_TX_RINGS instead of MAX_RX_RINGS. This can cause problems if the number of tx rings being used is greater than MAX_RX_RINGS.

---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
index 5088dc5..5944dd6 100644
@@ -2067,7 +2067,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		err = -ENOMEM;
 		goto out;
 	}
-	priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_RX_RINGS,
+	priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_TX_RINGS,
 			      GFP_KERNEL);
 	if (!priv->tx_cq) {
 		err = -ENOMEM;
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Kleber Sacilotto de Souza

The memory to hold the network device tx_cq is not being allocated with the correct size in mlx4_en_init_netdev(). It should use MAX_TX_RINGS instead of MAX_RX_RINGS. This can cause problems if the number of tx rings being used is greater than MAX_RX_RINGS.

---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -0
index 5088dc5..5944dd6 100644

drivers/net/ethernet/mellanox/mlx4/en_netdev.c int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · line 2073

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2067,7 +2067,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		err = -ENOMEM;
 		goto out;
 	}
-	priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_RX_RINGS,
+	priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_TX_RINGS,
 			      GFP_KERNEL);
 	if (!priv->tx_cq) {
 		err = -ENOMEM;

(sorry for double posting - tried to send from my tablet in plain text without success).

maintainer Applied
#2 lore raw
In reply to Kleber Sacilotto de Souza

From: Kleber Sacilotto de Souza <[email protected]>
Date: Fri, 22 Feb 2013 21:58:02 -0300

Quoted 6 lines

The memory to hold the network device tx_cq is not being allocated with the correct size in mlx4_en_init_netdev(). It should use MAX_TX_RINGS instead of MAX_RX_RINGS. This can cause problems if the number of tx rings being used is greater than MAX_RX_RINGS.

Applied.