mirror-linux/tools/testing/selftests/kvm/lib
Sean Christopherson 7c329bbd3b KVM: selftests: Assert that vasprintf() is successful
Assert that vasprintf() succeeds as the "returned" string is undefined
on failure.  Checking the result also eliminates the only warning with
default options in KVM selftests, i.e. is the only thing getting in the
way of compile with -Werror.

  lib/test_util.c: In function ‘strdup_printf’:
  lib/test_util.c:390:9: error: ignoring return value of ‘vasprintf’
  declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  390 |         vasprintf(&str, fmt, ap);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

Don't bother capturing the return value, allegedly vasprintf() can only
fail due to a memory allocation failure.

Fixes: dfaf20af76 ("KVM: arm64: selftests: Replace str_with_index with strdup_printf")
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Anup Patel <anup@brainfault.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Tested-by: Andrew Jones <ajones@ventanamicro.com>
Message-Id: <20230914010636.1391735-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-09-20 12:26:31 -04:00
..
aarch64 KVM: selftests: Add arch ucall.h and inline simple arch hooks 2023-08-02 14:42:52 -07:00
riscv KVM: selftests: Add arch ucall.h and inline simple arch hooks 2023-08-02 14:42:52 -07:00
s390x KVM: selftests: Add arch ucall.h and inline simple arch hooks 2023-08-02 14:42:52 -07:00
x86_64 KVM: selftests: Print out guest RIP on unhandled exception 2023-08-02 14:43:17 -07:00
assert.c KVM: selftests: Gracefully handle empty stack traces 2022-09-30 06:38:00 -04:00
elf.c KVM: selftests: kvm_vm_elf_load() and elfhdr_get() should close fd 2023-01-24 10:06:30 -08:00
guest_modes.c selftests: KVM: Replace optarg with arg in guest_modes_cmdline 2023-02-08 06:38:47 -08:00
guest_sprintf.c KVM: selftests: Add guest_snprintf() to KVM selftests 2023-08-02 14:41:59 -07:00
io.c selftests: kvm: Uses TEST_FAIL in tests/utilities 2020-03-16 17:59:11 +01:00
kvm_util.c KVM: selftests: Add additional pages to the guest to accommodate ucall 2023-08-02 14:41:59 -07:00
memstress.c KVM: selftests: Move dirty logging functions to memstress.(c|h) 2023-06-01 14:03:18 -07:00
rbtree.c KVM: selftests: Keep track of memslots more efficiently 2021-05-27 07:45:54 -04:00
sparsebit.c KVM: selftests: Remove superfluous variable assignment 2023-08-02 14:13:07 -07:00
string_override.c KVM: selftests: Add strnlen() to the string overrides 2023-08-02 14:41:59 -07:00
test_util.c KVM: selftests: Assert that vasprintf() is successful 2023-09-20 12:26:31 -04:00
ucall_common.c KVM: selftests: Add formatted guest assert support in ucall framework 2023-08-02 14:41:59 -07:00
userfaultfd_util.c KVM: selftests: Allow dumping per-vcpu info for uffd threads 2023-05-31 14:05:15 -07:00