aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/net/net_tx_pkt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
index 1f9aa59..1cb1125 100644
--- a/hw/net/net_tx_pkt.c
+++ b/hw/net/net_tx_pkt.c
@@ -450,11 +450,13 @@ void net_tx_pkt_reset(struct NetTxPkt *pkt)
pkt->payload_len = 0;
pkt->payload_frags = 0;
- assert(pkt->raw);
- for (i = 0; i < pkt->raw_frags; i++) {
- assert(pkt->raw[i].iov_base);
- pci_dma_unmap(pkt->pci_dev, pkt->raw[i].iov_base, pkt->raw[i].iov_len,
- DMA_DIRECTION_TO_DEVICE, 0);
+ if (pkt->max_raw_frags > 0) {
+ assert(pkt->raw);
+ for (i = 0; i < pkt->raw_frags; i++) {
+ assert(pkt->raw[i].iov_base);
+ pci_dma_unmap(pkt->pci_dev, pkt->raw[i].iov_base,
+ pkt->raw[i].iov_len, DMA_DIRECTION_TO_DEVICE, 0);
+ }
}
pkt->raw_frags = 0;