vfio/platform: store mapped memory in region, instead of an on-stack copy
authorJames Morse <james.morse@arm.com>
Thu, 29 Oct 2015 16:50:43 +0000 (16:50 +0000)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 3 Nov 2015 19:54:00 +0000 (12:54 -0700)
commit1b4bb2eaa9b2583521611b4aa978f9f499c92cd4
tree30ce8bb09a0c5d957a12499fc8608d39c2eac008
parent4644321fd3c119a819ab24fd2bc2d1f9bca4a695
vfio/platform: store mapped memory in region, instead of an on-stack copy

vfio_platform_{read,write}_mmio() call ioremap_nocache() to map
a region of io memory, which they store in struct vfio_platform_region to
be eventually re-used, or unmapped by vfio_platform_regions_cleanup().

These functions receive a copy of their struct vfio_platform_region
argument on the stack - so these mapped areas are always allocated, and
always leaked.

Pass this argument as a pointer instead.

Fixes: 6e3f26456009 "vfio/platform: read and write support for the device fd"
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
Tested-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/platform/vfio_platform_common.c