nvme_disk: Add missing checks in the case where there is only one iovec.
May fix the remaining KDL in #16973.
This commit is contained in:
@@ -701,10 +701,11 @@ nvme_disk_io(void* cookie, io_request* request)
|
|||||||
bounceAll = true;
|
bounceAll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if we need to bounce due to the first or last vec (which, unlike middle vecs,
|
// See if we need to bounce due to the first or last vecs.
|
||||||
// need only be a multiple of the block size, and must end and start on a page boundary,
|
|
||||||
// respectively, though the start address must always be 32-bit-aligned.)
|
|
||||||
if (nvme_request.iovec_count > 1) {
|
if (nvme_request.iovec_count > 1) {
|
||||||
|
// There are middle vecs, so the first and last vecs have different restrictions: they
|
||||||
|
// need only be a multiple of the block size, and must end and start on a page boundary,
|
||||||
|
// respectively, though the start address must always be 32-bit-aligned.
|
||||||
physical_entry* entry = &nvme_request.iovecs[0];
|
physical_entry* entry = &nvme_request.iovecs[0];
|
||||||
if (!bounceAll && (((entry->address + entry->size) % B_PAGE_SIZE) != 0
|
if (!bounceAll && (((entry->address + entry->size) % B_PAGE_SIZE) != 0
|
||||||
|| (entry->address & 0x3) != 0 || (entry->size % block_size) != 0))
|
|| (entry->address & 0x3) != 0 || (entry->size % block_size) != 0))
|
||||||
@@ -714,6 +715,12 @@ nvme_disk_io(void* cookie, io_request* request)
|
|||||||
if (!bounceAll && ((entry->address % B_PAGE_SIZE) != 0
|
if (!bounceAll && ((entry->address % B_PAGE_SIZE) != 0
|
||||||
|| (entry->size % block_size) != 0))
|
|| (entry->size % block_size) != 0))
|
||||||
bounceAll = true;
|
bounceAll = true;
|
||||||
|
} else {
|
||||||
|
// There is only one vec. Check that it is a multiple of the block size,
|
||||||
|
// and that its address is 32-bit-aligned.
|
||||||
|
physical_entry* entry = &nvme_request.iovecs[0];
|
||||||
|
if (!bounceAll && ((entry->address & 0x3) != 0 || (entry->size % block_size) != 0))
|
||||||
|
bounceAll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if we need to bounce due to rounding.
|
// See if we need to bounce due to rounding.
|
||||||
|
|||||||
Reference in New Issue
Block a user