viostor: Fix potential NULL dereference
The static driver verifier build flags this as a potential NULL
dereference. If SRB_GET_SENSE_INFO_BUFFER fails senseBuffer will
be NULL.
viostor\virtio_stor.c(1342): warning C6011: Dereferencing NULL pointer 'senseBuffer'.
@@ -1341,8 +1341,10 @@ RhelScsiGetCapacity(
PSENSE_DATA senseBuffer = NULL;
UCHAR ScsiStatus = SCSISTAT_CHECK_CONDITION;
SRB_GET_SENSE_INFO_BUFFER(Srb, senseBuffer);
+ if (senseBuffer) {
senseBuffer->SenseKey = SCSI_SENSE_ILLEGAL_REQUEST;
senseBuffer->AdditionalSenseCode = SCSI_ADSENSE_INVALID_CDB;
+ }
SRB_SET_SCSI_STATUS(((PSRB_TYPE)Srb), ScsiStatus);
return SrbStatus;
}
