diff mbox series

[1/1] KVM: selftests: close the memfd in some gmem tests

Message ID 20240227015716.27284-1-dongli.zhang@oracle.com
State Accepted
Commit e9da6f08edb0bd4c621165496778d77a222e1174
Headers show
Series [1/1] KVM: selftests: close the memfd in some gmem tests | expand

Commit Message

Dongli Zhang Feb. 27, 2024, 1:57 a.m. UTC
Add the missing close(fd) in guest_memfd_test.c and
private_mem_conversions_test.c.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 tools/testing/selftests/kvm/guest_memfd_test.c                 | 3 +++
 .../selftests/kvm/x86_64/private_mem_conversions_test.c        | 2 ++
 2 files changed, 5 insertions(+)


base-commit: b82879c81b4f09d040e365f9eb7ca036d86dcdfd

Comments

Sean Christopherson March 6, 2024, 12:29 a.m. UTC | #1
On Mon, 26 Feb 2024 17:57:16 -0800, Dongli Zhang wrote:
> Add the missing close(fd) in guest_memfd_test.c and
> private_mem_conversions_test.c.

Applied to kvm-x86 selftests, with a massaged changelog.  Thanks!

[1/1] KVM: selftests: Explicitly close guest_memfd files in some gmem tests
      https://github.com/kvm-x86/linux/commit/e9da6f08edb0

--
https://github.com/kvm-x86/linux/tree/next
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c
index c78a98c1a915..92eae206baa6 100644
--- a/tools/testing/selftests/kvm/guest_memfd_test.c
+++ b/tools/testing/selftests/kvm/guest_memfd_test.c
@@ -167,6 +167,9 @@  static void test_create_guest_memfd_multiple(struct kvm_vm *vm)
 	TEST_ASSERT(ret != -1, "memfd fstat should succeed");
 	TEST_ASSERT(st1.st_size == 4096, "first memfd st_size should still match requested size");
 	TEST_ASSERT(st1.st_ino != st2.st_ino, "different memfd should have different inode numbers");
+
+	close(fd2);
+	close(fd1);
 }
 
 int main(int argc, char *argv[])
diff --git a/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c b/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
index 65ad38b6be1f..e0f642d2a3c4 100644
--- a/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
+++ b/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
@@ -434,6 +434,8 @@  static void test_mem_conversions(enum vm_mem_backing_src_type src_type, uint32_t
 
 	r = fallocate(memfd, FALLOC_FL_KEEP_SIZE, 0, memfd_size);
 	TEST_ASSERT(!r, __KVM_SYSCALL_ERROR("fallocate()", r));
+
+	close(memfd);
 }
 
 static void usage(const char *cmd)