aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-08-18 10:56:40 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-08-18 10:56:41 +0100
commit5844365fe8e5e4598222d276d2af54fd45c7e3d3 (patch)
tree19001993b6377443c5efcebf17064d2685cf3543
parent4b887ae65880bf7eae53ba8af40599581fe759e5 (diff)
parente9e0a5854b6dc888f44e7e280a007326714199a6 (diff)
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Thu 18 Aug 2016 06:36:16 BST # gpg: using RSA key 0xEF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: net/net: properly handle multiple packets in net_fill_rstate() net: vmxnet: use g_new for pkt initialisation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/net/net_tx_pkt.c5
-rw-r--r--net/net.c8
2 files changed, 6 insertions, 7 deletions
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
index 53dfaa292c..20b25496e5 100644
--- a/hw/net/net_tx_pkt.c
+++ b/hw/net/net_tx_pkt.c
@@ -65,10 +65,9 @@ void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev,
p->pci_dev = pci_dev;
- p->vec = g_malloc((sizeof *p->vec) *
- (max_frags + NET_TX_PKT_PL_START_FRAG));
+ p->vec = g_new(struct iovec, max_frags + NET_TX_PKT_PL_START_FRAG);
- p->raw = g_malloc((sizeof *p->raw) * max_frags);
+ p->raw = g_new(struct iovec, max_frags);
p->max_payload_frags = max_frags;
p->max_raw_frags = max_frags;
diff --git a/net/net.c b/net/net.c
index c124b11e4d..d51cb29882 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1602,9 +1602,8 @@ void net_socket_rs_init(SocketReadState *rs,
/*
* Returns
- * 0: SocketReadState is not ready
- * 1: SocketReadState is ready
- * otherwise error occurs
+ * 0: success
+ * -1: error occurs
*/
int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size)
{
@@ -1652,10 +1651,11 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size)
if (rs->finalize) {
rs->finalize(rs);
}
- return 1;
}
break;
}
}
+
+ assert(size == 0);
return 0;
}