From: John Snow Date: Wed, 10 Feb 2016 18:29:40 +0000 (-0500) Subject: ahci: Do not unmap NULL addresses X-Git-Tag: qemu-xen-4.8.0-rc1~478^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=99b4cb71069f109b79b27bc629fc0cf0886dbc4b;p=qemu-xen.git ahci: Do not unmap NULL addresses 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 --- diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 7e87b1805e..3a95dadbd6 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;