DMAResource: Validate that alignment <= block_size.
The code here cannot handle the case where alignment > block_size, so anything calling Init() with these parameters is invalid. Fixes #15902 (nvme_disk was long since adjusted, so this is a defense against code being written in the future.)
This commit is contained in:
@@ -158,6 +158,8 @@ status_t
|
|||||||
DMAResource::Init(const dma_restrictions& restrictions,
|
DMAResource::Init(const dma_restrictions& restrictions,
|
||||||
generic_size_t blockSize, uint32 bufferCount, uint32 bounceBufferCount)
|
generic_size_t blockSize, uint32 bufferCount, uint32 bounceBufferCount)
|
||||||
{
|
{
|
||||||
|
ASSERT(restrictions.alignment <= blockSize);
|
||||||
|
|
||||||
fRestrictions = restrictions;
|
fRestrictions = restrictions;
|
||||||
fBlockSize = blockSize == 0 ? 1 : blockSize;
|
fBlockSize = blockSize == 0 ? 1 : blockSize;
|
||||||
fBufferCount = bufferCount;
|
fBufferCount = bufferCount;
|
||||||
|
|||||||
Reference in New Issue
Block a user