summaryrefslogtreecommitdiff
path: root/storage/class/disk/src/disk.c
diff options
context:
space:
mode:
authordwimmel-msft <[email protected]>2022-05-04 11:03:57 -0700
committerGitHub <[email protected]>2022-05-04 11:03:57 -0700
commita423bafcdcf7a58de7d3abd284f6107e4cce329f (patch)
treea5fd33f061d96ad3151270816f4dcb4f3d86476c /storage/class/disk/src/disk.c
parent30f39e4a535b0b4bc7215fdeee6b6d3a0659a797 (diff)
[storage/class/disk] Use ExAllocatePool2 (#712)
Diffstat (limited to 'storage/class/disk/src/disk.c')
-rw-r--r--storage/class/disk/src/disk.c73
1 files changed, 18 insertions, 55 deletions
diff --git a/storage/class/disk/src/disk.c b/storage/class/disk/src/disk.c
index 2bfcb35d..c8dbeb59 100644
--- a/storage/class/disk/src/disk.c
+++ b/storage/class/disk/src/disk.c
@@ -1288,7 +1288,7 @@ Return Value:
srbSize = sizeof(SCSI_REQUEST_BLOCK);
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
if (srb == NULL) {
@@ -1303,7 +1303,6 @@ Return Value:
return(STATUS_INSUFFICIENT_RESOURCES);
}
- RtlZeroMemory(srb, srbSize);
if (fdoExtension->AdapterDescriptor->SrbType == SRB_TYPE_STORAGE_REQUEST_BLOCK) {
srbEx = (PSTORAGE_REQUEST_BLOCK)srb;
@@ -1849,7 +1848,7 @@ Return Value:
// Allocate buffer for mode select header, block descriptor, and mode page.
//
- buffer = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
length2,
DISK_TAG_MODE_DATA);
@@ -1857,8 +1856,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(buffer, length2);
-
//
// Set length in header to size of mode page.
//
@@ -2719,7 +2716,7 @@ Return Value:
// Allocate Srb from nonpaged pool.
//
- context = ExAllocatePoolWithTag(NonPagedPoolNx,
+ context = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(COMPLETION_CONTEXT),
DISK_TAG_CCONTEXT);
@@ -2739,12 +2736,6 @@ Return Value:
srbEx = &context->Srb.SrbEx;
//
- // Zero out srb
- //
-
- RtlZeroMemory(srbEx, sizeof(context->Srb.SrbExBuffer));
-
- //
// Set up STORAGE_REQUEST_BLOCK fields
//
@@ -2767,12 +2758,6 @@ Return Value:
} else {
//
- // Zero out srb.
- //
-
- RtlZeroMemory(srb, SCSI_REQUEST_BLOCK_SIZE);
-
- //
// Write length to SRB.
//
@@ -2891,7 +2876,7 @@ DiskGetInfoExceptionInformation(
// ReturnPageData is allocated by the caller
//
- modeData = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
MODE_DATA_SIZE,
DISK_TAG_INFO_EXCEPTION);
@@ -2902,8 +2887,6 @@ DiskGetInfoExceptionInformation(
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(modeData, MODE_DATA_SIZE);
-
length = ClassModeSense(FdoExtension->DeviceObject,
(PCHAR) modeData,
MODE_DATA_SIZE,
@@ -3031,7 +3014,7 @@ Return Value:
- modeData = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
MODE_DATA_SIZE,
DISK_TAG_DISABLE_CACHE);
@@ -3042,8 +3025,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(modeData, MODE_DATA_SIZE);
-
length = ClassModeSense(FdoExtension->DeviceObject,
(PCHAR) modeData,
MODE_DATA_SIZE,
@@ -3175,7 +3156,7 @@ Return Value:
PAGED_CODE();
- modeData = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
MODE_DATA_SIZE,
DISK_TAG_DISABLE_CACHE);
@@ -3186,8 +3167,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(modeData, MODE_DATA_SIZE);
-
length = ClassModeSense(FdoExtension->DeviceObject,
(PCHAR) modeData,
MODE_DATA_SIZE,
@@ -4041,7 +4020,7 @@ Return Value:
srbSize = SCSI_REQUEST_BLOCK_SIZE;
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
@@ -4050,8 +4029,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srb, srbSize);
-
//
// Send a TUR to determine if media is present.
//
@@ -4133,7 +4110,7 @@ Return Value:
}
modeLength = MODE_DATA_SIZE;
- modeData = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
modeLength,
DISK_TAG_MODE_DATA);
@@ -4143,8 +4120,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(modeData, modeLength);
-
//
// Build the MODE SENSE CDB using previous SRB.
//
@@ -4329,7 +4304,7 @@ Return Value:
//
readBufferSize = fdoExtension->DiskGeometry.BytesPerSector;
- readBuffer = ExAllocatePoolWithTag(NonPagedPoolNx,
+ readBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED,
readBufferSize,
DISK_TAG_SMART);
@@ -4553,7 +4528,7 @@ Return Value:
} else {
srbSize = SCSI_REQUEST_BLOCK_SIZE;
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
@@ -4562,8 +4537,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srb, srbSize);
-
//
// Add disk offset to starting sector.
//
@@ -4593,7 +4566,7 @@ Return Value:
}
}
- Context = ExAllocatePoolWithTag(NonPagedPoolNx,
+ Context = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(DISK_VERIFY_WORKITEM_CONTEXT),
DISK_TAG_WI_CONTEXT);
if (Context) {
@@ -4705,7 +4678,7 @@ Return Value:
} else {
srbSize = SCSI_REQUEST_BLOCK_SIZE;
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
@@ -4714,8 +4687,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srb, srbSize);
-
//
// Build the data buffer to be transferred in the input buffer.
// The format of the data to the device is:
@@ -4912,7 +4883,7 @@ Return Value:
} else {
srbSize = SCSI_REQUEST_BLOCK_SIZE;
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
@@ -4921,8 +4892,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srb, srbSize);
-
//
// Build the data buffer to be transferred in the input buffer.
// The format of the data to the device is:
@@ -5098,7 +5067,7 @@ Return Value:
} else {
srbSize = SCSI_REQUEST_BLOCK_SIZE;
}
- srb = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srb = ExAllocatePool2(POOL_FLAG_NON_PAGED,
srbSize,
DISK_TAG_SRB);
@@ -5107,8 +5076,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srb, srbSize);
-
//
// Allocate memory for a mode header and then some
// for port drivers that need to convert to MODE10
@@ -5117,7 +5084,7 @@ Return Value:
//
modeLength = MODE_DATA_SIZE;
- modeData = ExAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
+ modeData = ExAllocatePool2(POOL_FLAG_NON_PAGED | POOL_FLAG_CACHE_ALIGNED,
modeLength,
DISK_TAG_MODE_DATA);
@@ -5127,8 +5094,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(modeData, modeLength);
-
//
// Build the MODE SENSE CDB
//
@@ -5573,7 +5538,7 @@ Return Value:
return STATUS_BUFFER_TOO_SMALL;
}
- srbControl = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srbControl = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(SRB_IO_CONTROL) +
sizeof(GETVERSIONINPARAMS),
DISK_TAG_SMART);
@@ -5583,8 +5548,6 @@ Return Value:
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(srbControl, sizeof(SRB_IO_CONTROL) + sizeof(GETVERSIONINPARAMS));
-
//
// fill in srbControl fields
//
@@ -5774,7 +5737,7 @@ Return Value:
return STATUS_INVALID_PARAMETER;
}
- srbControl = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srbControl = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(SRB_IO_CONTROL) + length,
DISK_TAG_SMART);
@@ -6032,7 +5995,7 @@ Return Value:
}
length += max(sizeof(SENDCMDOUTPARAMS), sizeof(SENDCMDINPARAMS));
- srbControl = ExAllocatePoolWithTag(NonPagedPoolNx,
+ srbControl = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(SRB_IO_CONTROL) + length,
DISK_TAG_SMART);