patch-2.3.10 linux/drivers/net/arcnet.c

Next file: linux/drivers/net/ariadne.c
Previous file: linux/drivers/net/arc-rimi.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/drivers/net/arcnet.c linux/drivers/net/arcnet.c
@@ -471,9 +471,16 @@
 
 #ifdef CONFIG_ARCNET_1051
   /* Initialize the RFC1051-encap protocol driver */
-  lp->sdev=(struct device *)kmalloc(sizeof(struct device),GFP_KERNEL);
+  lp->sdev=(struct device *)kmalloc(sizeof(struct device)+10,GFP_KERNEL);
+  if(lp->sdev = NULL)
+  {
+  	if(lp->edev)
+  		kfree(lp->edev);
+  	lp->edev=NULL;
+  	return -ENOMEM;
+  }
   memcpy(lp->sdev,dev,sizeof(struct device));
-  lp->sdev->name=(char *)kmalloc(10,GFP_KERNEL);
+  lp->sdev->name=(char *)(lp+1);
   sprintf(lp->sdev->name,"%ss",dev->name);
   lp->sdev->init=arcnetS_init;
   register_netdevice(lp->sdev);
@@ -562,7 +569,6 @@
   /* free the RFC1051-encap protocol device */
   lp->sdev->priv=NULL;
   unregister_netdevice(lp->sdev);
-  kfree(lp->sdev->name);
   kfree(lp->sdev);
   lp->sdev=NULL;
 #endif
@@ -1991,7 +1997,7 @@
 int arcnet_num_devs=0;
 char arcnet_dev_names[MAX_ARCNET_DEVS][10];
 
-__initfunc(void arcnet_init(void))
+void __init arcnet_init(void)
 {
   int c;
 
@@ -2041,7 +2047,7 @@
 #ifdef MODULE
 int init_module(void)
 #else
-__initfunc(static int init_module(void))
+static int __init init_module(void)
 #endif
 {
 #ifdef ALPHA_WARNING

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)