diff options
author | John Snow <jsnow@redhat.com> | 2016-02-10 13:29:40 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:41:57 -0600 |
commit | 63325ba9257ae90b6bbaed99f9d3df5392e75bab (patch) | |
tree | 9db0dc242ea5c96b865a18bfb9a837cf855ba447 /hw/ide | |
parent | ed3cc8a811091bff0f84114769e87479c794924e (diff) | |
download | hqemu-63325ba9257ae90b6bbaed99f9d3df5392e75bab.zip hqemu-63325ba9257ae90b6bbaed99f9d3df5392e75bab.tar.gz |
ahci: Do not unmap NULL addresses
Definitely don't try to unmap a garbage address.
Reported-by: Zuozhi fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1454103689-13042-2-git-send-email-jsnow@redhat.com
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/ahci.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |