Commit 1ff735bd authored by Kevin Wolf's avatar Kevin Wolf

block: Detect unaligned length in bdrv_qiov_is_aligned()

For an O_DIRECT request to succeed, it's not only necessary that all
base addresses in the qiov are aligned, but also that each length in it
is aligned.
Signed-off-by: default avatarKevin Wolf <>
Reviewed-by: default avatarWenchao Xia <>
Reviewed-by: default avatarMax Reitz <>
parent e5354657
......@@ -4811,6 +4811,9 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) {
return false;
if (qiov->iov[i].iov_len % bs->buffer_alignment) {
return false;
return true;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment