BufAfterReqCompletedIntIoctlA rule (kmdf)

The BufAfterReqCompletedIntIoctlA rule verifies that after a request is completed, its buffer cannot be accessed (inside EvtIoInternalDeviceControl callback only). The buffer was retrieved by calling WdfRequestRetrieveInputBuffer or WdfRequestRetrieveOutputBuffer or WdfRequestRetrieveUnsafeUserInputBuffer or WdfRequestRetrieveUnsafeUserOutputBuffer.

Within the EvtIoInternalDeviceControl I/O queue event callback function, the request buffer retrieved by calling WdfRequestRetrieveInputBuffer or WdfRequestRetrieveOutputBuffer or WdfRequestRetrieveUnsafeUserInputBuffer or WdfRequestRetrieveUnsafeUserOutputBuffer cannot be accessed after the WdfRequestComplete, WdfRequestCompleteWithInformation, or WdfRequestCompleteWithPriorityBoost methods have been called on the request. The following possible buffer access functions are considered: RtlMoveMemory (with the buffer as a 1st and 2nd parameter), RtlZeroMemory, RtlCompareMemory, ZwReadFile, ZwWriteFile, WDF_MEMORY_DESCRIPTOR_INIT_BUFFER, WdfMemoryCreatePreallocated, WdfMemoryAssignBuffer, WdfMemoryCopyFromBuffer, WdfMemoryCopyToBuffer.

Driver modelKMDF

How to test

At compile time

Run Static Driver Verifier and specify the BufAfterReqCompletedIntIoctlA rule.

Use the following steps to run an analysis of your code:
  1. Prepare your code (use role type declarations).
  2. Run Static Driver Verifier.
  3. View and analyze the results.

For more information, see Using Static Driver Verifier to Find Defects in Drivers.

Applies to

WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
WdfMemoryAssignBuffer
WdfMemoryCopyFromBuffer
WdfMemoryCopyToBuffer
WdfMemoryCreatePreallocated
WdfRequestComplete
WdfRequestCompleteWithInformation
WdfRequestCompleteWithPriorityBoost
WdfRequestRetrieveInputBuffer
WdfRequestRetrieveOutputBuffer
WdfRequestRetrieveUnsafeUserInputBuffer
WdfRequestRetrieveUnsafeUserOutputBuffer
RtlCompareMemory
RtlMoveMemory
RtlZeroMemory
ZwReadFile

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft