On Fri, 13 Sept 2024 at 16:55, Peter Xu <pet...@redhat.com> wrote: > > On Thu, Sep 12, 2024 at 03:27:55PM +0100, Peter Maydell wrote: > > Coverity is pretty unhappy about this trick, because it isn't able > > to recognise that we can figure out the address of 'bounce' > > from the address of 'bounce->buffer' and free it in the > > address_space_unmap() code, so it thinks that every use > > of address_space_map(), pci_dma_map(), etc, is a memory leak. > > We can mark all those as false positives, of course, but it got > > me wondering whether maybe we should have this function return > > a struct that has all the information address_space_unmap() > > needs rather than relying on it being able to figure it out > > from the host memory pointer... > > Indeed that sounds like a viable option. Looks like we don't have a lot of > address_space_map() users.
There's quite a few wrappers of it too, so it's a little hard to count. We might want to avoid the memory allocation in the common case by having the caller pass in an ASMapInfo struct to be filled in rather than having address_space_map() allocate-and-return one. -- PMM