Thread (2 messages) flat view 2 messages, 2 authors, 2d ago

[PATCH, net-next] net/mlx5: Use kfree() to match kzalloc_obj() in mlx5_events_cleanup()

From: lirongqing <hidden>
Date: 2026-08-18 12:25:53
Also in: linux-rdma, lkml
Subsystem: mellanox mlx5 core vpi driver, networking drivers, the rest · Maintainers: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Li RongQing <redacted>

dev->priv.events is allocated in mlx5_events_init() with kzalloc_obj(),
which is a kmalloc-family allocator, so it must be released with kfree().

kvfree() happens to work here because it falls back to kfree() for
non-vmalloc addresses, but it is semantically imprecise. Use kfree() to
correctly pair with the allocation and to match the error path in
mlx5_events_init(), which already uses kfree(events).

Signed-off-by: Li RongQing <redacted>
---
 drivers/net/ethernet/mellanox/mlx5/core/events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c
index 4d7f35b..fc5ecce 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/events.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c
@@ -396,7 +396,7 @@ int mlx5_events_init(struct mlx5_core_dev *dev)
 void mlx5_events_cleanup(struct mlx5_core_dev *dev)
 {
 	destroy_workqueue(dev->priv.events->wq);
-	kvfree(dev->priv.events);
+	kfree(dev->priv.events);
 }
 
 void mlx5_events_start(struct mlx5_core_dev *dev)
-- 
2.9.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help