Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alioth/src/hv/hv_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl IrqFd for TestIrqFd {

impl AsFd for TestIrqFd {
fn as_fd(&self) -> BorrowedFd<'_> {
unreachable!()
unsafe { BorrowedFd::borrow_raw(0) }
}
}

Expand Down
10 changes: 9 additions & 1 deletion alioth/src/virtio/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,15 @@ where
if let Some(q) = self.queues.get(q_sel)
&& !q.enabled.load(Ordering::Acquire)
{
q.size.store(val as u16, Ordering::Release);
if val.is_power_of_two()
|| VirtioFeature(self.reg.get_driver_feature())
.contains(VirtioFeature::RING_PACKED)
&& val > 0
{
q.size.store(val as u16, Ordering::Release);
} else {
log::warn!("{}: queue {q_sel}: invalid queue size: {val}", self.name);
}
}
}
VirtioCommonCfg::LAYOUT_QUEUE_MSIX_VECTOR => {
Expand Down
Loading