ice: memory leak in ice_vsi_alloc_stat_arrays
Subsystems (2)
PATCH 1/1 ice: memory leak in ice_vsi_alloc_stat_arrays
Fix memory leak by checking if stats were already allocated before allocating new one.
Previously it was completely broken, because new allocated value was checked instead of previous one.
---
Should be squashed with commit eace2cbe7f5f ("ice: split ice_vsi_setup into smaller functions")
--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +4 -4
@@ -558,14 +558,14 @@ static int ice_vsi_alloc_stat_arrays(struct ice_vsi *vsi)if (!pf->vsi_stats)return -ENOENT ; +if (pf->vsi_stats[vsi->idx]) +/* realloc will happen in rebuild path */ +return 0 ; + vsi_stat =kzalloc (sizeof (*vsi_stat),GFP_KERNEL );if (!vsi_stat)return -ENOMEM ; -if (vsi_stat->tx_ring_stats && vsi_stat->rx_ring_stats) -/* realloc will happen in rebuild path */ -return 0 ; - vsi_stat->tx_ring_stats =kcalloc (vsi->alloc_txq,sizeof (*vsi_stat->tx_ring_stats),GFP_KERNEL );
Signature · 6 lines
2.36.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Wednesday, January 11, 2023 2:37 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]
Subject: [Intel-wired-lan] [PATCH] ice: memory leak inice_vsi_alloc_stat_arraysFix memory leak by checking if stats were already allocated before allocating new one.
Previously it was completely broken, because new allocated value was checked instead of previous one.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 7 lines
---
Should be squashed with commiteace2cbe7f5f("ice: splitice_vsi_setupinto smaller functions")--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Thanks for catching this!
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 36 lines
-----Original Message-----
From: Ertman, David M
Sent: Thursday, January 12, 2023 9:03 AM
To: Michal Swiatkowski <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]
Subject: RE: [Intel-wired-lan] [PATCH] ice: memory leak inice_vsi_alloc_stat_arraysQuoted 6 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Wednesday, January 11, 2023 2:37 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>;Quoted 12 lines
Subject: [Intel-wired-lan] [PATCH] ice: memory leak in
ice_vsi_alloc_stat_arraysFix memory leak by checking if stats were already allocated before allocating new one.
Previously it was completely broken, because new allocated value was checked instead of previous one.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>Quoted 7 lines
---
Should be squashed with commiteace2cbe7f5f("ice: splitice_vsi_setupinto smaller functions")--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 3 lines
Thanks for catching this!
Reviewed-by Dave Ertman <[email protected]>
Please clean-up variable ret, since it is not needed any more. Also can probably clean up braces that won't be needed any more also.
DaveE
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 36 lines · David M
Quoted 36 lines
-----Original Message-----
From: Ertman, David M
Sent: Thursday, January 12, 2023 9:03 AM
To: Michal Swiatkowski <[email protected]>; intel-wired- [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]
Subject: RE: [Intel-wired-lan] [PATCH] ice: memory leak inice_vsi_alloc_stat_arraysQuoted 6 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Wednesday, January 11, 2023 2:37 AM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>;Quoted 19 lines
Subject: [Intel-wired-lan] [PATCH] ice: memory leak in
ice_vsi_alloc_stat_arraysFix memory leak by checking if stats were already allocated before allocating new one.
Previously it was completely broken, because new allocated value was checked instead of previous one.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>---
Should be squashed with commiteace2cbe7f5f("ice: splitice_vsi_setupinto smaller functions")--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 3 lines
Thanks for catching this!
Reviewed-by Dave Ertman <[email protected]>Please clean-up variable ret, since it is not needed any more. Also can probably clean up braces that won't be needed any more also.
Done, thanks
Quoted 1 line
DaveE
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Wednesday, January 11, 2023 4:07 PM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]
Subject: [Intel-wired-lan] [PATCH] ice: memory leak inice_vsi_alloc_stat_arraysFix memory leak by checking if stats were already allocated before allocating new one.
Previously it was completely broken, because new allocated value was checked instead of previous one.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 7 lines
---
Should be squashed with commiteace2cbe7f5f("ice: splitice_vsi_setupinto smaller functions")--- drivers/net/ethernet/intel/ice/ice_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan