public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fec_mxc: incomplete error handling
@ 2009-12-11  8:47 John Ogness
  2009-12-14  6:00 ` Ben Warren
  0 siblings, 1 reply; 2+ messages in thread
From: John Ogness @ 2009-12-11  8:47 UTC (permalink / raw)
  To: u-boot

fec_init() will only allocate fec->base_ptr if it is non-NULL. But
the cleanup routine on error will free the pointer without setting
it to NULL. This means that a later call to fec_init() would result
in using an invalid pointer.

The following patch to fix this is against u-boot-2009.11-rc2.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
 drivers/net/fec_mxc.c |    1 +
 1 file changed, 1 insertion(+)
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -450,6 +450,7 @@ static int fec_init(struct eth_device *d
 	 */
 	if (fec_rbd_init(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE) < 0) {
 		free(fec->base_ptr);
+		fec->base_ptr = NULL;
 		return -ENOMEM;
 	}
 	fec_tbd_init(fec);

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

end of thread, other threads:[~2009-12-14  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11  8:47 [U-Boot] [PATCH] fec_mxc: incomplete error handling John Ogness
2009-12-14  6:00 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox