Skip to content

Commit a9bf67e

Browse files
nicolincjgunthorpe
authored andcommitted
iommufd/selftest: Add asserts testing global mfd
The mfd and mfd_buffer will be used in the tests directly without an extra check. Test them in setup_sizes() to ensure they are safe to use. Fixes: 0bcceb1 ("iommufd: Selftest coverage for IOMMU_IOAS_MAP_FILE") Link: https://patch.msgid.link/r/94bdc11d2b6d5db337b1361c5e5fce0ed494bb40.1750787928.git.nicolinc@nvidia.com Cc: [email protected] Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 4b75e3b commit a9bf67e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/testing/selftests/iommu/iommufd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ static __attribute__((constructor)) void setup_sizes(void)
5454

5555
mfd_buffer = memfd_mmap(BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
5656
&mfd);
57+
assert(mfd_buffer != MAP_FAILED);
58+
assert(mfd > 0);
5759
}
5860

5961
FIXTURE(iommufd)

0 commit comments

Comments
 (0)