public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Patch to sd.c in 2.4.16
@ 2001-11-30 22:48 Pete Zaitcev
  0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2001-11-30 22:48 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel, Pete Zaitcev

Hi, Marcelo (and the list):

Here's a patch that fixes kfree of static data in sd.c
(and bizzare ooses), also a modest cleanup. Please consider.
It's a fallout of one guy attaching 150 disks.

-- Pete

--- linux-2.4.16/drivers/scsi/sd.c	Fri Nov  9 14:05:06 2001
+++ linux-2.4.16-niph/drivers/scsi/sd.c	Thu Nov 29 19:25:22 2001
@@ -1157,8 +1157,6 @@
                         SCSI_DISKS_PER_MAJOR * sizeof *sd_gendisks[i].flags);
 		sd_gendisks[i].major = SD_MAJOR(i);
 		sd_gendisks[i].major_name = "sd";
-		sd_gendisks[i].minor_shift = 4;
-		sd_gendisks[i].max_p = 1 << 4;
 		sd_gendisks[i].part = sd + (i * SCSI_DISKS_PER_MAJOR << 4);
 		sd_gendisks[i].sizes = sd_sizes + (i * SCSI_DISKS_PER_MAJOR << 4);
 		sd_gendisks[i].nr_real = 0;
@@ -1175,7 +1173,8 @@
 		kfree(sd_gendisks[i].de_arr);
 		kfree(sd_gendisks[i].flags);
 	}
-	kfree(sd_gendisks);
+	if (sd_gendisks != &sd_gendisk)
+		kfree(sd_gendisks);
 cleanup_sd_gendisks:
 	kfree(sd);
 cleanup_sd:
@@ -1305,8 +1304,8 @@
 	}
 	DEVICE_BUSY = 1;
 
-	max_p = sd_gendisks->max_p;
-	start = target << sd_gendisks->minor_shift;
+	max_p = sd_gendisk.max_p;
+	start = target << sd_gendisk.minor_shift;
 
 	for (i = max_p - 1; i >= 0; i--) {
 		int index = start + i;
@@ -1365,7 +1364,6 @@
 			}
                         devfs_register_partitions (&SD_GENDISK (i),
                                                    SD_MINOR_NUMBER (start), 1);
-			/* unregister_disk() */
 			dpnt->has_part_table = 0;
 			dpnt->device = NULL;
 			dpnt->capacity = 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-11-30 22:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-30 22:48 Patch to sd.c in 2.4.16 Pete Zaitcev

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