Author: cwittich
Date: Sun Jul 8 17:38:08 2007
New Revision: 27473
URL:
http://svn.reactos.org/svn/reactos?rev=27473&view=rev
Log:
-avoid dereferencing of NULL pointers
Modified:
trunk/reactos/drivers/storage/scsiport/scsiport.c
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/s…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.c (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.c Sun Jul 8 17:38:08 2007
@@ -3087,6 +3087,9 @@
/* Build the actual SG list */
while (TotalLength < Srb->DataTransferLength)
{
+ if (!ScatterGatherList)
+ break;
+
ScatterGatherList->Length = Srb->DataTransferLength - TotalLength;
ScatterGatherList->PhysicalAddress =
IoMapTransfer(DeviceExtension->AdapterObject,
Irp->MdlAddress,
@@ -3649,7 +3652,7 @@
/* Scan all logical units */
for (Lun = 0; Lun < SCSI_MAXIMUM_LOGICAL_UNITS; Lun++)
{
- if (!LunExtension)
+ if ((!LunExtension) || (!LunInfo))
break;
/* Add extension to the list */
@@ -3934,6 +3937,12 @@
TRUE,
TRUE,
TRUE);
+
+ if (!Srb)
+ {
+ DPRINT("SpiSendRequestSense() failed, Srb %p\n", Srb);
+ return;
+ }
IrpStack = IoGetNextIrpStackLocation(Irp);
IrpStack->MajorFunction = IRP_MJ_SCSI;