summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-03-10 17:29:57 -0500
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-03-10 17:30:27 -0500
commit346a608c16d76c82e901586155820c371447dc95 (patch)
treef7fc1f8d03bc1409e6168475749d389329619f1f
parent3d6f977dbe79dceaf931d09a38380937abdd8423 (diff)
Edge case cleanup in vchan
-rw-r--r--vchan/init.c2
-rw-r--r--vchan/node-select.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/vchan/init.c b/vchan/init.c
index 2e53b83..4660042 100644
--- a/vchan/init.c
+++ b/vchan/init.c
@@ -235,7 +235,7 @@ static int init_gnt_cli(struct libvchan *ctrl, uint32_t ring_ref)
return rv;
out_unmap_left:
if (ctrl->write.order >= PAGE_SHIFT)
- munmap(ctrl->write.buffer, (1 << ctrl->write.order - PAGE_SHIFT));
+ munmap(ctrl->write.buffer, 1 << ctrl->write.order);
out_unmap_ring:
munmap(ctrl->ring, PAGE_SIZE);
ctrl->ring = 0;
diff --git a/vchan/node-select.c b/vchan/node-select.c
index eb5fd8b..d62ab3e 100644
--- a/vchan/node-select.c
+++ b/vchan/node-select.c
@@ -46,8 +46,10 @@ void vchan_wr() {
if (!insiz)
return;
int ret = libvchan_write(ctrl, inbuf, insiz);
- if (ret < 0)
+ if (ret < 0) {
+ fprintf(stderr, "vchan write failed\n");
exit(1);
+ }
if (ret > 0) {
insiz -= ret;
memmove(inbuf, inbuf + ret, insiz);