From patchwork Mon Nov 26 18:55:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 202008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3263C2C008D for ; Tue, 27 Nov 2012 05:56:31 +1100 (EST) Received: from localhost ([::1]:50777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td3r3-0005AV-7M for incoming@patchwork.ozlabs.org; Mon, 26 Nov 2012 13:56:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td3qh-0004ya-3A for qemu-devel@nongnu.org; Mon, 26 Nov 2012 13:56:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Td3qb-0003eR-Fl for qemu-devel@nongnu.org; Mon, 26 Nov 2012 13:56:07 -0500 Received: from cantor2.suse.de ([195.135.220.15]:35493 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td3qb-0003eA-99; Mon, 26 Nov 2012 13:56:01 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 9F609A4D02; Mon, 26 Nov 2012 19:56:00 +0100 (CET) From: Alexander Graf To: "qemu-devel@nongnu.org qemu-devel" Date: Mon, 26 Nov 2012 19:55:52 +0100 Message-Id: <1353956157-26879-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1353956157-26879-1-git-send-email-agraf@suse.de> References: <1353956157-26879-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Blue Swirl , Peter Maydell , "qemu-ppc@nongnu.org List" , Aurelien Jarno Subject: [Qemu-devel] [PATCH 1/6] hw/ide/macio: Fix segfault caused by NULL DMAContext* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell 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 Signed-off-by: Peter Maydell Signed-off-by: Alexander Graf --- hw/ide/macio.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 720af6e..d2edcc0 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;