summaryrefslogtreecommitdiff
path: root/hw/ide/macio.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-11-20 08:16:51 +0000
committerAlexander Graf <agraf@suse.de>2012-11-26 19:53:26 +0100
commitd688e5239aad2a1f991147974832ce026f78c1a3 (patch)
tree64e7ae9da6f13f58601d5abeccee8f97e243948a /hw/ide/macio.c
parentcab1e8f3e37d8e883c270e3afd9c7c1c18332f0e (diff)
downloadqemu-d688e5239aad2a1f991147974832ce026f78c1a3.tar.gz
hw/ide/macio: Fix segfault caused by NULL DMAContext*
Pass qemu_sglist_init the global dma_context_memory rather than a NULL pointer; this fixes a segfault in dma_memory_map() when the guest starts using DMA. Reported-by: Amadeusz Sławiński <amade@asmblr.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/ide/macio.c')
-rw-r--r--hw/ide/macio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 720af6ed9b..d2edcc0850 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -76,7 +76,8 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
+ &dma_context_memory);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;
@@ -132,7 +133,8 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
s->io_buffer_index = 0;
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, NULL);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1,
+ &dma_context_memory);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;