From 1516d630c7d42edfc7b3c819296db5153c2914e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Mon, 16 Dec 2024 18:27:21 +0100 Subject: [PATCH] fix(virtqueue): make `BufferElem::{len,capacity}` return `u32` --- src/drivers/virtio/virtqueue/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/virtio/virtqueue/mod.rs b/src/drivers/virtio/virtqueue/mod.rs index dcda58d70e..cfc86a4688 100644 --- a/src/drivers/virtio/virtqueue/mod.rs +++ b/src/drivers/virtio/virtqueue/mod.rs @@ -268,7 +268,7 @@ trait VirtqPrivate { paging::virt_to_phys(VirtAddr::from_ptr(mem_descr.addr())) .as_u64() .into(), - u32::from(len).into(), + len.into(), incomplete_flags | virtq::DescF::NEXT, ) }); @@ -356,7 +356,7 @@ impl BufferElem { // should be only relevant for read buffer elements, which should not be uninit. // If the element belongs to a write buffer, it is likely that [Self::capacity] // is more appropriate. - pub fn len(&self) -> u16 { + pub fn len(&self) -> u32 { match self { BufferElem::Sized(sized) => mem::size_of_val(sized.as_ref()), BufferElem::Vector(vec) => vec.len(), @@ -365,7 +365,7 @@ impl BufferElem { .unwrap() } - pub fn capacity(&self) -> u16 { + pub fn capacity(&self) -> u32 { match self { BufferElem::Sized(sized) => mem::size_of_val(sized.as_ref()), BufferElem::Vector(vec) => vec.capacity(),