block: Check request total length is a multiple of SECTOR_SIZE

The request can be spread over multiple descriptors but the virtio-block
specification (and this code) expects that is a whole number of sectors
(512 bytes).

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-07-08 15:32:30 +01:00
committed by Bo Chen
parent 5b99f9ce41
commit 1ba5f15198
2 changed files with 6 additions and 1 deletions

View File

@@ -71,6 +71,8 @@ pub enum Error {
GetFileMetadata(#[source] io::Error),
#[error("The requested operation would cause a seek beyond disk end")]
InvalidOffset,
#[error("Request data length is not a multiple of the 512-byte sector size")]
InvalidDataLength,
#[error("Failure in qcow")]
QcowError(#[source] qcow::Error),
#[error("The requested operation does not support multiple descriptors")]