Skip to contentSkip to conversation

sd.c - null ptr fixes for 2.4.4

PATCH Praveen Srinivasan 1 participant 1 message May 25, 2001 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Here is a revised patch. Did you mean "free SRpnt" by "surely you need to return the request"? The function returns an int. If that is what you meant, our revised patch fixes that.

Thanks,
Praveen Srinivasan and Frederick Akalin

drivers/scsi/sd.c Thu May 24 22:48:12 2001 renamed from drivers/scsi/sd.c.old Sat Feb 3 11:45:55 2001 +10 -2
@@ -731,11 +731,19 @@
         * We need to retry the READ_CAPACITY because a UNIT_ATTENTION is
         * considered a fatal error, and many devices report such an error
         * just after a scsi bus reset.
-        */
-
+        */
        SRpnt = scsi_allocate_request(rscsi_disks[i].device);
 
+       if(SRpnt == NULL) {
+               return i;
+       }
+
        buffer = (unsigned char *) scsi_malloc(512);
+
+       if(buffer == NULL) {
+               scsi_release_request(SRpnt);
+               return i;
+       }
 
        spintime = 0;
 
Quoted 27 lines · Alan Cox
Quoted 6 lines

This patch fixes a couple of errors in the scsi driver code (sd.c).

drivers/scsi/sd.c Mon May 7 22:09:58 2001 renamed from linux/./drivers/scsi/sd.c Sat Feb 3 11:45:55 2001 +0 -0
@@ -734,8 +734,15 @@
 */

drivers/scsi/sd.c Mon May 7 22:09:58 2001 line 744

Quoted 10 lines
drivers/scsi/sd.c Mon May 7 22:09:58 2001 renamed from linux/./drivers/scsi/sd.c Sat Feb 3 11:45:55 2001 +6 -0
 
 SRpnt = scsi_allocate_request(rscsi_disks[i].device);
+    if(SRpnt == NULL) {
+      return i;
+    }
 
 buffer = (unsigned char *) scsi_malloc(512);
+
+    if(buffer == NULL) {
+      return i;

You need to return the request surely

Quoted 1 line

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/