diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-06-24 02:20:48 -0700 |
---|---|---|
committer | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-06-24 02:20:48 -0700 |
commit | 9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229 (patch) | |
tree | 39a5c2a8e314b0951aa62344a2085a73a4eef015 /lib/dma.h | |
parent | 883d8e66c0cbba493e78d4077b8c0b1b01e987d8 (diff) | |
download | libvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.zip libvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.tar.gz libvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.tar.bz2 |
don't blindly trust region_hint
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/dma.h')
-rw-r--r-- | lib/dma.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -139,7 +139,8 @@ dma_addr_to_sg(const dma_controller_t *dma, // Fast path: single region. if (likely(max_sg > 0 && len > 0 && - dma_addr >= region->dma_addr && dma_addr + len <= region_end)) { + dma_addr >= region->dma_addr && dma_addr + len <= region_end && + region_hint < dma->nregions)) { sg->region = region_hint; sg->offset = dma_addr - region->dma_addr; sg->length = len; |