patch-2.4.6 linux/drivers/scsi/hosts.c

Next file: linux/drivers/scsi/osst.c
Previous file: linux/drivers/scsi/gdth.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c
@@ -168,6 +168,11 @@
     retval->loaded_as_module = 1;
     if (flag_new) {
 	shn = (Scsi_Host_Name *) kmalloc(sizeof(Scsi_Host_Name), GFP_ATOMIC);
+        if (!shn) {
+                kfree(retval);
+                printk(KERN_ERR "scsi: out of memory(2) in scsi_register.\n");
+                return NULL;
+        }
 	shn->name = kmalloc(hname_len + 1, GFP_ATOMIC);
 	if (hname_len > 0)
 	    strncpy(shn->name, hname, hname_len);

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