All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak
@ 2011-05-16  5:24 Yoshinori Sato
  2011-07-27 21:19 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Yoshinori Sato @ 2011-05-16  5:24 UTC (permalink / raw)
  To: u-boot

Hi,

I found memory leak in sh_eth.c.
sh_eth_desc_init call for many times in network problem.
And it every time allocate new descriptor. So leak old descriptor.

I will fix this patch.

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 17dd0d2..f805785 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -313,6 +313,9 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
 	struct sh_eth_info *port_info = &eth->port_info[port];
 	struct tx_desc_s *cur_tx_desc;
 
+	if (port_info->tx_desc_malloc)
+		/* Already allocated. re-using it */
+		return 0;
 	/*
 	 * Allocate tx descriptors. They must be TX_DESC_SIZE bytes aligned
 	 */
@@ -365,6 +368,9 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 	u32 tmp_addr;
 	u8 *rx_buf;
 
+	if (port_info->rx_desc_malloc)
+		/* Already allocated. re-using it */
+		return 0;
 	/*
 	 * Allocate rx descriptors. They must be RX_DESC_SIZE bytes aligned
 	 */

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

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

* [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak
  2011-05-16  5:24 [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak Yoshinori Sato
@ 2011-07-27 21:19 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2011-07-27 21:19 UTC (permalink / raw)
  To: u-boot

Dear Yoshinori Sato,

In message <87vcxbp69w.wl%ysato@users.sourceforge.jp> you wrote:
> Hi,
> 
> I found memory leak in sh_eth.c.
> sh_eth_desc_init call for many times in network problem.
> And it every time allocate new descriptor. So leak old descriptor.
> 
> I will fix this patch.
> 
> diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
> index 17dd0d2..f805785 100644

Can you please resubmit this with your Signed-off-by: line added?
Please see http://www.denx.de/wiki/U-Boot/Patches for additional help
how to create and submit patches.

Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If the facts don't fit the theory, change the facts.
                                                   -- Albert Einstein

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

end of thread, other threads:[~2011-07-27 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16  5:24 [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak Yoshinori Sato
2011-07-27 21:19 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.