From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaao-0008E0-Pe for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTaak-0003Bc-Oo for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaak-0003BT-K4 for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:22 -0500 From: John Snow Date: Wed, 10 Feb 2016 14:38:06 -0500 Message-Id: <1455133089-31903-10-git-send-email-jsnow@redhat.com> In-Reply-To: <1455133089-31903-1-git-send-email-jsnow@redhat.com> References: <1455133089-31903-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PULL 08/11] ahci: Do not unmap NULL addresses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jsnow@redhat.com Definitely don't try to unmap a garbage address. Reported-by: Zuozhi fzz Signed-off-by: John Snow Message-id: 1454103689-13042-2-git-send-email-jsnow@redhat.com --- hw/ide/ahci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 7e87b18..3a95dad 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -662,6 +662,10 @@ static bool ahci_map_fis_address(AHCIDevice *ad) static void ahci_unmap_fis_address(AHCIDevice *ad) { + if (ad->res_fis == NULL) { + DPRINTF(ad->port_no, "Attempt to unmap NULL FIS address\n"); + return; + } dma_memory_unmap(ad->hba->as, ad->res_fis, 256, DMA_DIRECTION_FROM_DEVICE, 256); ad->res_fis = NULL; @@ -678,6 +682,10 @@ static bool ahci_map_clb_address(AHCIDevice *ad) static void ahci_unmap_clb_address(AHCIDevice *ad) { + if (ad->lst == NULL) { + DPRINTF(ad->port_no, "Attempt to unmap NULL CLB address\n"); + return; + } dma_memory_unmap(ad->hba->as, ad->lst, 1024, DMA_DIRECTION_FROM_DEVICE, 1024); ad->lst = NULL; -- 2.4.3