From: sashiko-bot@kernel.org
To: "Hemanth Selam" <hemanth.selam@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v1 1/2] KVM: selftests: SEV: Verify unsupported VM types are rejected at creation
Date: Thu, 09 Jul 2026 16:55:59 +0000 [thread overview]
Message-ID: <20260709165600.7440A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709164751.621326-2-hemanth.selam@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unreachable file descriptor cleanup logic due to `TEST_ASSERT` abortion behavior.
--
--- Patch [1]: [PATCH v1 1/2] KVM: selftests: SEV: Verify unsupported VM types are rejected at creation ---
commit 6d2bb062d11a83854e4168e36bd8f632c92e6ba6
Author: Hemanth Selam <hemanth.selam@gmail.com>
KVM: selftests: SEV: Verify unsupported VM types are rejected at creation
This commit adds a new test to verify that unsupported SEV VM types are
rejected by KVM_CREATE_VM. It introduces a helper function to test invalid
types and asserts that the creation fails with -EINVAL.
> diff --git a/tools/testing/selftests/kvm/x86/sev_init2_tests.c b/tools/testing/selftests/kvm/x86/sev_init2_tests.c
> index 8db88c355f165..724ff11f16c94 100644
> --- a/tools/testing/selftests/kvm/x86/sev_init2_tests.c
> +++ b/tools/testing/selftests/kvm/x86/sev_init2_tests.c
[ ... ]
> @@ -73,19 +74,34 @@ static void test_init2_invalid(unsigned long vm_type, struct kvm_sev_init *init,
> kvm_vm_free(vm);
> }
>
> +static void test_create_invalid_type(unsigned long vm_type, const char *msg)
> +{
> + int fd = __kvm_ioctl(kvm_fd, KVM_CREATE_VM, (void *)vm_type);
> +
> + TEST_ASSERT(fd < 0 && errno == EINVAL,
> + "KVM_CREATE_VM should reject unsupported type (%s), got fd=%d errno=%d",
> + msg, fd, errno);
> + if (fd >= 0)
> + close(fd);
[Severity: Low]
Since TEST_ASSERT() will unconditionally abort the test program if the
condition fails (which happens if fd >= 0), is this close() block dead code?
If the assert passes, fd is strictly less than 0, making the condition
false. If the assert fails, the program terminates before reaching the
close() statement.
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709164751.621326-1-hemanth.selam@gmail.com?part=1
next prev parent reply other threads:[~2026-07-09 16:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 16:47 [PATCH v1 0/2] KVM: selftests: SEV: address two TODOs in the SEV tests Hemanth Selam
2026-07-09 16:47 ` [PATCH v1 1/2] KVM: selftests: SEV: Verify unsupported VM types are rejected at creation Hemanth Selam
2026-07-09 16:55 ` sashiko-bot [this message]
2026-07-09 16:47 ` [PATCH v1 2/2] KVM: selftests: SEV: Sanity check the launch measurement Hemanth Selam
2026-07-09 17:49 ` [PATCH v2 0/2] KVM: selftests: SEV: address two TODOs in the SEV tests Hemanth Selam
2026-07-09 17:49 ` [PATCH v2 1/2] KVM: selftests: SEV: Verify unsupported VM types are rejected at creation Hemanth Selam
2026-07-09 20:21 ` Sean Christopherson
2026-07-10 5:06 ` Hemanth Selam
2026-07-09 17:49 ` [PATCH v2 2/2] KVM: selftests: SEV: Sanity check the launch measurement Hemanth Selam
2026-07-10 5:04 ` [PATCH v3] KVM: selftests: Add a test for KVM_CREATE_VM VM type enforcement Hemanth Selam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709165600.7440A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hemanth.selam@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox