Windows Stop Code 0x00000040: TARGET_MDL_TOO_SMALL
Quick Answer TARGET_MDL_TOO_SMALL (0x00000040) means a driver incorrectly called IoBuildPartialMdl with a target memory descriptor list that was too small to...
Quick Answer
TARGET_MDL_TOO_SMALL (0x00000040) means a driver incorrectly called IoBuildPartialMdl with a target memory descriptor list that was too small to describe the requested address range. Microsoft identifies this as a driver bug. The practical remedy is to identify the responsible driver and obtain a corrected version, roll back a problematic update, or remove the associated component through a supported procedure. Microsoft Learn
For recurring crashes, preserve a crash dump. IT professionals and driver developers can use it to inspect the call involving IoBuildPartialMdl and determine which driver supplied the invalid target MDL.
What Is an MDL?
A memory descriptor list, or MDL, describes the physical memory pages backing a virtual memory buffer used for input/output operations.
Its required size depends on the buffer it describes. The MDL contains a structure followed by information about the buffer’s physical pages, so allocating space for the structure alone is not necessarily sufficient. Microsoft Learn
A partial MDL describes a portion of a buffer already represented by another MDL. Drivers use IoBuildPartialMdl to construct that description, for example when dividing a larger transfer into smaller operations. The caller must supply a target MDL with enough capacity for the requested pages. Microsoft Learn
What Causes Stop Code 0x40?
The documented failure is an undersized target MDL passed to IoBuildPartialMdl. Microsoft defines no bug-check parameters for 0x40.
The code establishes the failed operation but does not name the responsible driver. Microsoft recommends examining the function’s stack trace and checking the target-size calculation. Microsoft Learn
Before You Begin
- Save your work and back up important files.
- Record the stop code, crash time, and any driver filename displayed.
- Note recent driver updates, newly installed devices, and device-related software.
- Have administrator access available for driver rollback.
- Keep the BitLocker recovery key available before entering recovery options.
- On a managed computer, coordinate changes with IT support. support.microsoft.com
The interface steps below use Windows 11 terminology. Older Windows versions can have different menus.
Recommended Troubleshooting
1. Review Recent Changes
Record whether crashes began after a device installation or driver update. Also note which operation preceded each crash.
If newly added external hardware is a plausible suspect, shut down the PC, disconnect it, and restart. This is part of Microsoft’s general stop-error troubleshooting. A stable result helps isolate the affected device path but does not prove that the hardware itself is defective. support.microsoft.com
2. Roll Back a Suspected Driver Update
If the timing or dump evidence points to a recently updated device:
- Right-click Start and select Device Manager.
- Locate the device and open Properties.
- Select Driver > Roll Back Driver, when available.
- Follow the prompts and restart if requested.
If rollback is unavailable, Windows may not have a previous driver available to restore. support.microsoft.com
3. Install a Compatible Driver Update
When rollback is unsuitable or ineffective:
- Check Windows Update for applicable updates.
- Check the device manufacturer’s official support page.
- Obtain a driver matching the device and Windows version.
- Follow the manufacturer’s installation instructions.
- Restart and test.
Change one suspected component at a time. If an update introduces a new problem, roll it back where possible or reinstall the appropriate manufacturer driver. support.microsoft.com
If a dump implicates a driver installed with an application, contact that application’s vendor for its supported update or removal procedure.
4. Use Safe Mode if Normal Startup Fails
- Access the Windows Recovery Environment.
- Select Troubleshoot > Advanced options > Startup Settings > Restart.
- Press 4 or F4 to enable Safe Mode.
- Investigate or reverse the suspected recent change.
- Restart normally to test.
Safe Mode loads a limited set of drivers and services. An encrypted device may request its BitLocker recovery key. support.microsoft.com
Advanced Troubleshooting with WinDbg
Preserve and Analyze the Dump
When configured and successfully written, small dumps normally appear in %SystemRoot%\Minidump. Kernel and several other dump types commonly use %SystemRoot%\MEMORY.DMP.
Open the relevant dump in WinDbg with appropriate symbols and run:
!analyze -v
Review the call stack, module information, and the driver calling IoBuildPartialMdl. This command provides diagnostic information; it does not repair the driver. learn.microsoft.com
If the dump lacks the memory required for further inspection, support personnel may need a more complete dump. A small dump can omit information necessary to establish the cause. learn.microsoft.com
Checks for Driver Developers
Inspect the arguments to the failing function:
| Argument | Purpose |
|---|---|
SourceMdl |
Describes the original buffer |
TargetMdl |
Caller-allocated MDL that will describe the selected portion |
VirtualAddress |
Starting virtual address of that portion |
Length |
Number of bytes to describe |
Verify that the target allocation covers all pages touched by the requested range and that the range falls within the source buffer. Remember that a Length of zero means the remainder of the source range beginning at VirtualAddress; it does not mean an empty request. Microsoft Learn
Use the documented MDL allocation and access routines rather than modifying opaque MDL fields to conceal a sizing error. Validate the corrected driver in a test environment before deployment. Microsoft Learn
How to Verify the Fix
- Restart after installing or restoring the selected driver.
- Repeat the operation that previously preceded the crash.
- Confirm that the device and related application work.
- Monitor across multiple sessions if the original crash was intermittent.
If 0x40 returns, preserve the new dump and compare the identified driver and call path before making additional changes.
Frequently Asked Questions
Does “too small” mean the computer needs more RAM?
The documented problem concerns the size of a driver’s target MDL. Adding physical RAM does not correct an incorrect allocation calculation.
Can I increase the MDL size in Windows Settings?
Windows provides no user setting for correcting this driver allocation. The responsible driver must supply a correctly sized MDL.
Does the stop code identify a particular device?
No. The code identifies the failed operation. Dump analysis and recent-change history help identify the responsible driver. Microsoft Learn
Why does the analysis mention a Windows kernel function?
The kernel function may be where the invalid driver request was detected. Investigate the caller and its arguments before attributing responsibility to the kernel module.
Will reinstalling Windows reliably fix it?
Reinstallation is not a targeted correction for this programming error. Installing the same affected driver afterward can allow the problem to recur.
Conclusion
For TARGET_MDL_TOO_SMALL, prioritize identifying and correcting the driver that supplied the undersized MDL. Recent-change checks can help restore stability, while dump analysis provides the technical evidence needed for a lasting driver correction.
Sources
- Microsoft Learn — Bug Check 0x40: TARGET_MDL_TOO_SMALL.
- Microsoft Learn — IoBuildPartialMdl function.
- Microsoft Learn — Using MDLs.
- Microsoft Learn — Stop code error or bug check troubleshooting.
- Microsoft Learn — Small Memory Dump.
- Microsoft Support — Update drivers through Device Manager in Windows.
- Microsoft Support — Windows startup settings.
- Microsoft Support — Troubleshooting Windows unexpected restarts and stop code errors.
Was this guide useful?
Your answer helps us keep BISONKB accurate and practical.