diff mbox

[v3] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'

Message ID 20180516190720.11633-1-christophe.jaillet@wanadoo.fr (mailing list archive)
State Not Applicable
Headers show

Commit Message

Christophe JAILLET May 16, 2018, 7:07 p.m. UTC
When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to
free it.

Fixes: 1cbe6fc86ccfe ("IB/mlx5: Add support for CQE compressing")
Fixes: fed9ce22bf8ae ("net/mlx5: E-Switch, Add API to create vport rx rules")
Fixes: 9efa75254593d ("net/mlx5_core: Introduce access functions to query vport RoCE fields")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v1 -> v2: More places to update have been added to the patch
v2 -> v3: Add Fixes tag

3 patches with one Fixes tag each should probably be better, but honestly, I won't send a v4.
Fill free to split it if needed.
---
 drivers/infiniband/hw/mlx5/cq.c                            | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/vport.c            | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Saeed Mahameed May 17, 2018, 12:42 a.m. UTC | #1
T24gV2VkLCAyMDE4LTA1LTE2IGF0IDIxOjA3ICswMjAwLCBDaHJpc3RvcGhlIEpBSUxMRVQgd3Jv
dGU6DQo+IFdoZW4gJ2t2emFsbG9jKCknIGlzIHVzZWQgdG8gYWxsb2NhdGUgbWVtb3J5LCAna3Zm
cmVlKCknIG11c3QgYmUgdXNlZA0KPiB0bw0KPiBmcmVlIGl0Lg0KPiANCj4gRml4ZXM6IDFjYmU2
ZmM4NmNjZmUgKCJJQi9tbHg1OiBBZGQgc3VwcG9ydCBmb3IgQ1FFIGNvbXByZXNzaW5nIikNCj4g
Rml4ZXM6IGZlZDljZTIyYmY4YWUgKCJuZXQvbWx4NTogRS1Td2l0Y2gsIEFkZCBBUEkgdG8gY3Jl
YXRlIHZwb3J0IHJ4DQo+IHJ1bGVzIikNCj4gRml4Z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9uaWNfdnBvcnRfbm9kZV9ndWlkKHN0cnVjdA0KPiBt
bHg1X2NvcmVfZGV2ICptZGV2LCB1NjQgKm5vZGVfZ3VpZCkNCj4gIAkqbm9kZV9ndWlkID0gTUxY
NV9HRVQ2NChxdWVyeV9uaWNfdnBvcnRfY29udGV4dF9vdXQsIG91dCwNCj4gIAkJCQluaWNfdnBv
cnRfY29udGV4dC5ub2RlX2d1aWQpOw0KPiAgDQo+IC0Ja2ZyZWUob3V0KTsNCj4gKwlrdmZyZWUo
b3V0KTsNCj4gIA0KPiAgCXJldHVybiAwOw0KPiAgfQ0KPiBAQCAtNTg3LDcgKzU4Nyw3IEBAIGlu
dCBtbHg1X3F1ZXJ5X25pY192cG9ydF9xa2V5X3Zpb2xfY250cihzdHJ1Y3QNCj4gbWx4NV9jb3Jl
X2RldiAqbWRldiwNCj4gIAkqcWtleV92aW9sX2NudHIgPSBNTFg1X0dFVChxdWVyeV9uaWNfdnBv
cnRfY29udGV4dF9vdXQsIG91dCwNCj4gIAkJCQkgICBuaWNfdnBvcnRfY29udGV4dC5xa2V5X3Zp
b2xhdGlvbl8NCj4gY291bnRlcik7DQo+ICANCj4gLQlrZnJlZShvdXQpOw0KPiArCWt2ZnJlZShv
dXQpOw0KPiAgDQo+ICAJcmV0dXJuIDA7DQo+ICB9
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 77d257ec899b..6d52ea03574e 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -849,7 +849,7 @@  static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
 	return 0;
 
 err_cqb:
-	kfree(*cqb);
+	kvfree(*cqb);
 
 err_db:
 	mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 35e256eb2f6e..b123f8a52ad8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -663,7 +663,7 @@  static int esw_create_vport_rx_group(struct mlx5_eswitch *esw)
 
 	esw->offloads.vport_rx_group = g;
 out:
-	kfree(flow_group_in);
+	kvfree(flow_group_in);
 	return err;
 }
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
index 177e076b8d17..719cecb182c6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
@@ -511,7 +511,7 @@  int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
 	*system_image_guid = MLX5_GET64(query_nic_vport_context_out, out,
 					nic_vport_context.system_image_guid);
 
-	kfree(out);
+	kvfree(out);
 
 	return 0;
 }
@@ -531,7 +531,7 @@  int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
 	*node_guid = MLX5_GET64(query_nic_vport_context_out, out,
 				nic_vport_context.node_guid);
 
-	kfree(out);
+	kvfree(out);
 
 	return 0;
 }
@@ -587,7 +587,7 @@  int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
 	*qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
 				   nic_vport_context.qkey_violation_counter);
 
-	kfree(out);
+	kvfree(out);
 
 	return 0;
 }