[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEUmHyaX5RUMZOE5G6nzXM8O-q0whCEv1ux7ceJY04uU+mw41g@mail.gmail.com>
Date: Tue, 23 Dec 2014 12:59:31 +0530
From: Varka Bhadram <varkabhadram@...il.com>
To: Jia-Ju Bai <baijiaju1990@....com>
Cc: "davem@...emloft.net" <davem@...emloft.net>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"Allan, Bruce W" <bruce.w.allan@...el.com>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"<linux.nics@...el.com>" <linux.nics@...el.com>,
"e1000-devel@...ts.sourceforge.net"
<e1000-devel@...ts.sourceforge.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 3/3] igb: Fix a memory leak in igb_probe
On Tue, Dec 23, 2014 at 12:47 PM, Jia-Ju Bai <baijiaju1990@....com> wrote:
> For linux-3.18.0
> The driver calls kcalloc to allocate memory for adapter->shadow_vfta
> in igb_sw_init, but kfree is not called in error handling of igb_probe.
> So when register_netdev or igb_init_i2c is failed, a memory leak occurs.
> This patch fixes this problem, and it has been tested in runtime.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@....com>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 487cd9c..a0be1e5 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2659,6 +2659,7 @@ err_eeprom:
> if (hw->flash_address)
> iounmap(hw->flash_address);
> err_sw_init:
> + kfree(adapter->shadow_vfta);
Why dont you use devm_kcalloc()..? So no need to worry about freeing it.
> igb_clear_interrupt_scheme(adapter);
> pci_iounmap(pdev, hw->hw_addr);
> err_ioremap:
> --
> 1.7.9.5
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists