| Previous | Next |
| kIOReturnNotWritable | kIOReturnBadMedia |
kIOReturnNotAligned
Alignment is part of the device I/O contract
kIOReturnNotAligned means that a memory range, offset, length, or related descriptor did not satisfy an alignment rule required by the IOKit path. The required boundary is not encoded in the error value. It can depend on the controller, bus, transfer mode, memory cursor, or the driver’s own descriptor format.
A buffer that looks aligned in user space can still be unsuitable after an offset is applied or when the operation requires a length that is a multiple of a hardware block. Conversely, forcing a pointer cast does not repair an invalid range. The driver must be able to map the complete transfer safely and describe it to the hardware.
What to verify
- Record the base address, requested offset, byte count, element size, and the alignment promised by the target API.
- Check the complete range: an aligned start with a nonconforming length can still fail.
- Use the documented buffer or memory-descriptor API instead of assuming that ordinary heap allocation satisfies a device-specific DMA requirement.
- When a protocol permits it, copy into an appropriately aligned staging buffer and preserve the original length and ownership rules.
References
- Apple Developer: kIOReturnNotAligned
- Apple XNU source: IOReturn.h
- Apple IOKit Fundamentals: memory descriptors and DMA constraints
Looking for a different code? Search another status or error code.