浏览代码

Fix bug in 405 ethernet driver; allocated data not cleared!

stroese 21 年之前
父节点
当前提交
18f71f27ae
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      cpu/ppc4xx/405gp_enet.c

+ 2 - 0
cpu/ppc4xx/405gp_enet.c

@@ -944,6 +944,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
 				"Cannot allocate eth_device %d\n", eth_num);
 				"Cannot allocate eth_device %d\n", eth_num);
 			return (-1);
 			return (-1);
 		}
 		}
+		memset(dev, 0, sizeof(*dev));
 		/* Allocate our private use data */
 		/* Allocate our private use data */
 		hw = (EMAC_405_HW_PST) malloc (sizeof (*hw));
 		hw = (EMAC_405_HW_PST) malloc (sizeof (*hw));
 		if (hw == NULL) {
 		if (hw == NULL) {
@@ -953,6 +954,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
 			free (dev);
 			free (dev);
 			return (-1);
 			return (-1);
 		}
 		}
+		memset(hw, 0, sizeof(*hw));
 
 
 		switch (eth_num) {
 		switch (eth_num) {
 		case 0:
 		case 0: