From: Dan Carpenter <dan.carpenter@linaro.org>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: kvm@vger.kernel.org
Subject: [bug report] nVMX: Test Host Segment Registers and Descriptor Tables on vmentry of nested guests
Date: Fri, 2 May 2025 16:06:21 +0300 [thread overview]
Message-ID: <aBTDTdGrZbWDW-Ui@stanley.mountain> (raw)
Hello Krish Sadhukhan,
Commit 95d6d2c32288 ("nVMX: Test Host Segment Registers and
Descriptor Tables on vmentry of nested guests") from Jun 28, 2019
(linux-next), leads to the following Smatch static checker warning:
x86/vmx_tests.c:7583 test_vmcs_field()
warn: maybe use && instead of &
x86/vmx_tests.c
7561 static void test_vmcs_field(u64 field, const char *field_name, u32 bit_start,
7562 u32 bit_end, u64 val, bool valid_val, u32 error)
7563 {
7564 u64 field_saved = vmcs_read(field);
7565 u32 i;
7566 u64 tmp;
7567 u32 bit_on;
7568 u64 mask = ~0ull;
7569
7570 mask = (mask >> bit_end) << bit_end;
7571 mask = mask | ((1 << bit_start) - 1);
7572 tmp = (field_saved & mask) | (val << bit_start);
7573
7574 vmcs_write(field, tmp);
7575 report_prefix_pushf("%s %lx", field_name, tmp);
7576 if (valid_val)
7577 test_vmx_vmlaunch(0);
7578 else
7579 test_vmx_vmlaunch(error);
7580 report_prefix_pop();
7581
7582 for (i = bit_start; i <= bit_end; i = i + 2) {
--> 7583 bit_on = ((1ull < i) & (val << bit_start)) ? 0 : 1;
^
This quite looks like it's supposed to be << instead of <.
7584 if (bit_on)
7585 tmp = field_saved | (1ull << i);
7586 else
7587 tmp = field_saved & ~(1ull << i);
7588 vmcs_write(field, tmp);
7589 report_prefix_pushf("%s %lx", field_name, tmp);
7590 if (valid_val)
7591 test_vmx_vmlaunch(error);
7592 else
7593 test_vmx_vmlaunch(0);
7594 report_prefix_pop();
7595 }
7596
7597 vmcs_write(field, field_saved);
7598 }
regards,
dan carpenter
reply other threads:[~2025-05-02 13:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aBTDTdGrZbWDW-Ui@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=krish.sadhukhan@oracle.com \
--cc=kvm@vger.kernel.org \
/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