summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index 2e31ffcb2c..b453713bdb 100644
--- a/exec.c
+++ b/exec.c
@@ -2099,7 +2099,9 @@ void *address_space_map(AddressSpace *as,
if (bounce.buffer) {
return NULL;
}
- bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, TARGET_PAGE_SIZE);
+ /* Avoid unbounded allocations */
+ l = MIN(l, TARGET_PAGE_SIZE);
+ bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, l);
bounce.addr = addr;
bounce.len = l;