aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/netfront.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-03-26 13:13:50 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-03-26 13:13:50 +0000
commitaecea1aa6522c44d8111731c8b6f0e9a6e08f001 (patch)
tree9c8efebd9eb0586717662f5462e1814a6495c751 /extras/mini-os/netfront.c
parenta363bc0ce024186ad26ec3c38074b7565b01611f (diff)
downloadxen-aecea1aa6522c44d8111731c8b6f0e9a6e08f001.tar.gz
xen-aecea1aa6522c44d8111731c8b6f0e9a6e08f001.tar.bz2
xen-aecea1aa6522c44d8111731c8b6f0e9a6e08f001.zip
minios: more assertions
- assert that we never allocate or free the same grant twice - assert that network packets do not exceed a page - assert that incoming network event IDs make sense Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/netfront.c')
-rw-r--r--extras/mini-os/netfront.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
index 3159c30445..acdc76d994 100644
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -120,6 +120,7 @@ moretodo:
if (rx->status == NETIF_RSP_NULL) continue;
int id = rx->id;
+ BUG_ON(id >= NET_TX_RING_SIZE);
buf = &dev->rx_buffers[id];
page = (unsigned char*)buf->page;
@@ -204,6 +205,7 @@ void network_tx_buf_gc(struct netfront_dev *dev)
printk("packet error\n");
id = txrsp->id;
+ BUG_ON(id >= NET_TX_RING_SIZE);
struct net_buffer* buf = &dev->tx_buffers[id];
gnttab_end_access(buf->gref);
buf->gref=GRANT_INVALID_REF;
@@ -510,6 +512,8 @@ void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len)
struct net_buffer* buf;
void* page;
+ BUG_ON(len > PAGE_SIZE);
+
down(&dev->tx_sem);
local_irq_save(flags);