All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch for sd cleanup
@ 2002-02-26  1:22 Pete Zaitcev
  2002-02-26  1:41 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2002-02-26  1:22 UTC (permalink / raw)
  To: linux-scsi, linux-kernel

Marcelo's 2.4.18 does not have this:

--- linux-2.4.18/drivers/scsi/sd.c	Mon Feb 25 11:38:04 2002
+++ linux-2.4.18-p3/drivers/scsi/sd.c	Mon Feb 25 17:09:59 2002
@@ -279,7 +279,7 @@
  	target = DEVICE_NR(dev);
 
 	dpnt = &rscsi_disks[target];
-	if (!dpnt)
+	if (!dpnt->device)
 		return NULL;	/* No such device */
 	return &dpnt->device->request_queue;
 }
@@ -302,7 +302,7 @@
 
 	dpnt = &rscsi_disks[dev];
 	if (devm >= (sd_template.dev_max << 4) ||
-	    !dpnt ||
+	    !dpnt->device ||
 	    !dpnt->device->online ||
  	    block + SCpnt->request.nr_sectors > sd[devm].nr_sects) {
 		SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", SCpnt->request.nr_sectors));

The subject was beaten to death on lists. The patch must go in.
BTW, 2.5 has the same defect.

Since we are on the topic of sd.c cleanup, here's one more for you.
I posted it before. Someone please try it out and let me know
if anything interesting happens (say, slab area corruption :)

--- linux-2.4.18/drivers/scsi/sd.c	Mon Feb 25 11:38:04 2002
+++ linux-2.4.18-p3/drivers/scsi/sd.c	Mon Feb 25 17:09:59 2002
@@ -1412,10 +1412,14 @@
 		kfree(sd_blocksizes);
 		kfree(sd_hardsizes);
 		kfree((char *) sd);
+		for (i = 0; i < N_USED_SD_MAJORS; i++) {
+			kfree(sd_gendisks[i].de_arr);
+			kfree(sd_gendisks[i].flags);
+		}
 	}
 	for (i = 0; i < N_USED_SD_MAJORS; i++) {
 		del_gendisk(&sd_gendisks[i]);
-		blk_size[SD_MAJOR(i)] = NULL;
+		blksize_size[SD_MAJOR(i)] = NULL;
 		hardsect_size[SD_MAJOR(i)] = NULL;
 		read_ahead[SD_MAJOR(i)] = 0;
 	}

-- Pete

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

end of thread, other threads:[~2002-02-26  1:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-26  1:22 Patch for sd cleanup Pete Zaitcev
2002-02-26  1:41 ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.