linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'
@ 2018-05-13  7:00 Christophe JAILLET
  2018-05-13 16:21 ` Eric Dumazet
  2018-05-15 22:21 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2018-05-13  7:00 UTC (permalink / raw)
  To: saeedm, matanb, leon, dledford, jgg, davem
  Cc: netdev, linux-rdma, linux-kernel, kernel-janitors, Christophe JAILLET

When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to
free it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v1 -> v2: More places to update have been added to the patch
---
 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(-)

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;
 }
-- 
2.17.0

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

* Re: [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'
  2018-05-13  7:00 [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()' Christophe JAILLET
@ 2018-05-13 16:21 ` Eric Dumazet
  2018-05-15 22:21 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-05-13 16:21 UTC (permalink / raw)
  To: Christophe JAILLET, saeedm, matanb, leon, dledford, jgg, davem
  Cc: netdev, linux-rdma, linux-kernel, kernel-janitors



On 05/13/2018 12:00 AM, Christophe JAILLET wrote:
> When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to
> free it.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v1 -> v2: More places to update have been added to the patch


Please add relevant Fixes: tag(s)

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

* Re: [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'
  2018-05-13  7:00 [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()' Christophe JAILLET
  2018-05-13 16:21 ` Eric Dumazet
@ 2018-05-15 22:21 ` Jason Gunthorpe
  2018-05-16  0:12   ` Saeed Mahameed
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2018-05-15 22:21 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: saeedm, matanb, leon, dledford, davem, netdev, linux-rdma,
	linux-kernel, kernel-janitors

On Sun, May 13, 2018 at 09:00:41AM +0200, Christophe JAILLET wrote:
> When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to
> free it.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v1 -> v2: More places to update have been added to the patch
> ---
>  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(-)

I agree with Eric on the need for fixes lines in v3..

> 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);

For the infiniband part:

Acked-by: Jason Gunthorpe <jgg@mellanox.com>

Since this is mostly ethernet, can it go through netdev? thanks

Jason

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

* Re: [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'
  2018-05-15 22:21 ` Jason Gunthorpe
@ 2018-05-16  0:12   ` Saeed Mahameed
  0 siblings, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2018-05-16  0:12 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Christophe JAILLET, Saeed Mahameed, Matan Barak, Leon Romanovsky,
	Doug Ledford, David S. Miller, Linux Netdev List,
	RDMA mailing list, linux-kernel, kernel-janitors

On Tue, May 15, 2018 at 3:21 PM, Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Sun, May 13, 2018 at 09:00:41AM +0200, Christophe JAILLET wrote:
>> When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used to
>> free it.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> v1 -> v2: More places to update have been added to the patch
>> ---
>>  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(-)
>
> I agree with Eric on the need for fixes lines in v3..
>
>> 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);
>
> For the infiniband part:
>
> Acked-by: Jason Gunthorpe <jgg@mellanox.com>
>
> Since this is mostly ethernet, can it go through netdev? thanks
>

for the mlx5 core parts:

Acked-by: Saeed Mahameed <saeedm@mellanox.com>

Yes i will take v3 to mlx5-next branch.

> Jason
> --
> 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

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

end of thread, other threads:[~2018-05-16  0:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-13  7:00 [PATCH v2] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()' Christophe JAILLET
2018-05-13 16:21 ` Eric Dumazet
2018-05-15 22:21 ` Jason Gunthorpe
2018-05-16  0:12   ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).