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>
This commit is contained in:
parent
cab1e8f3e3
commit
d688e5239a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user