mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
net_util: Check descriptor size
There is no point in queueing an empty descriptor in the list of iovecs. Let's simply ignore such case and avoid some unnecessary processing. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
1cd186c83c
commit
63304d0be7
@ -43,7 +43,7 @@ impl TxVirtio {
|
||||
|
||||
let mut iovecs = Vec::new();
|
||||
while let Some(desc) = next_desc {
|
||||
if !desc.is_write_only() {
|
||||
if !desc.is_write_only() && desc.len > 0 {
|
||||
let buf = mem
|
||||
.get_slice(desc.addr, desc.len as usize)
|
||||
.map_err(NetQueuePairError::GuestMemory)?
|
||||
@ -118,7 +118,7 @@ impl RxVirtio {
|
||||
|
||||
let mut iovecs = Vec::new();
|
||||
while let Some(desc) = next_desc {
|
||||
if desc.is_write_only() {
|
||||
if desc.is_write_only() && desc.len > 0 {
|
||||
let buf = mem
|
||||
.get_slice(desc.addr, desc.len as usize)
|
||||
.map_err(NetQueuePairError::GuestMemory)?
|
||||
|
Loading…
x
Reference in New Issue
Block a user