i40e: Fix possible memory leak in i40e_dbg_dump_desc
Subsystems (3)
PATCH 1/1 i40e: Fix possible memory leak in i40e_dbg_dump_desc
In reply to a message not in the archiveI didn't notice that return in the code, fix it by adding a goto out instead to free the memory.
Fixes:
Quoted 2 lines
New smatch warnings:
drivers/net/ethernet/intel/i40e/i40e_debugfs.c:832i40e_dbg_dump_desc()warn: possible memory leak of 'ring'
Signed-off-by Joe Perches <[email protected]>
---
Jeff Kirsher can legitimately give me a hard time now... Thanks Dan.
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +3 -1
@@ -829,7 +829,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,if (desc_n >= ring->count || desc_n <0 ) {dev_info (&pf->pdev->dev,"descriptor %d not found\n" , desc_n); -return ; + goto out; }if (!is_rx_ring) { txd =I40E_TX_DESC (ring, desc_n);
@@ -855,6 +855,8 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, }else {dev_info (&pf->pdev->dev,"dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n" ); } + +out:kfree (ring); }
Quoted 11 lines · Joe Perches
I didn't notice that return in the code, fix it by adding a goto out instead to free the memory.
Fixes:
Quoted 2 lines
New smatch warnings:
drivers/net/ethernet/intel/i40e/i40e_debugfs.c:832
i40e_dbg_dump_desc()warn: possible memory leak of 'ring'Signed-off-by Joe Perches <[email protected]>
Quoted 7 lines
---
Jeff Kirsher can legitimately give me a hard time now... Thanks Dan.
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Thanks Joe, I have added your patch to my queue.