Two thumbs up to Peter!
MDL describe the buffer, not the transfer. The concept is not so difficult
to understand. There can be many, many reasons why the buffer is larger;
alignment, separate transfers that break a large IO into smaller IOs, &c.
On Sat, Feb 4, 2017 at 10:57 AM wrote:
>
>
> You know, I’ve started to answer this thread three separate times, and
> each time I’ve lost the will to argue and deleted my answer.
>
> Mr. Sykes… with all due respect… from a Windows architectural
> perspective, you’re just wrong. Take this as an opportunity to learn
> something, instead of as an opportunity to argue. Mr. Roberts is rarely
> incorrect about such fundamental concepts, and he’s absolutely correct here.
>
> I will admit: If you spend most of your time in the upper parts of the
> storage stack (for example), it’s pretty easy to see the MDL as “the
> definitive description of the transfer”… but, really, it’s not.
>
> It turns out that there are some places were the MDL size and the I/O
> operation (read/write) length are identical. But any time there is a
> separate place to get the length of the operation (URB, I/O Stack, SRB) it
> is incorrect to rely on the size of the underlying MDL as the size of the
> operation.
>
> As Mr. Roberts and Mr. Grig described, the MDL describes the size of a
> buffer in kernel mode. That’s all it represents. When one performs an I/O
> operation from the described buffer, there is not ALWAYS the implication
> that the MDL describes the I/O operation.
>
> Whenever there’s a description of the I/O operation… pointer, length,
> whatever… that’s separate from the MDL, you use the separate
> description. The MDL has to be valid. And the actual data buffer used for
> the transfer has to be a valid subset of the buffer described by the MDL.
> That subset can be 100% of the MDL or just part of the MDL.
>
> This is just the way Windows architecture has been, since… well… at
> least 1992 when I started working with Windows NT.
>
> Peter
> OSR
> @OSRDrivers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer>
></http:>