All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Paul Durrant" <paul@xen.org>, "Wei Liu" <wl@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH] x86/CPUID: fill all fields in x86_cpuid_policy_fill_native()
Date: Mon, 22 Jun 2020 14:09:05 +0200	[thread overview]
Message-ID: <41177396-9944-0bbd-66d2-8b4f2bd063f0@suse.com> (raw)

Coverity validly complains that the new call from
tools/tests/cpu-policy/test-cpu-policy.c:test_cpuid_current() leaves
two fields uninitialized, yet they get then consumed by
x86_cpuid_copy_to_buffer(). (All other present callers of the function
pass a pointer to a static - and hence initialized - buffer.)

Coverity-ID: 1464809
Fixes: c22ced93e167 ("tests/cpu-policy: Confirm that CPUID serialisation is sorted")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -176,6 +176,10 @@ void x86_cpuid_policy_fill_native(struct
                           ARRAY_SIZE(p->extd.raw) - 1); ++i )
         cpuid_leaf(0x80000000 + i, &p->extd.raw[i]);
 
+    /* Don't report leaves from possible lower level hypervisor. */
+    p->hv_limit = 0;
+    p->hv2_limit = 0;
+
     x86_cpuid_policy_recalc_synth(p);
 }
 


             reply	other threads:[~2020-06-22 12:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 12:09 Jan Beulich [this message]
2020-06-22 12:39 ` [PATCH] x86/CPUID: fill all fields in x86_cpuid_policy_fill_native() Andrew Cooper
2020-06-22 13:37   ` Jan Beulich
2020-06-22 13:59     ` Andrew Cooper
2020-06-24 15:32   ` Ping: " Jan Beulich
2020-06-24 15:35   ` Jan Beulich
2020-06-25  6:57     ` Paul Durrant

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=41177396-9944-0bbd-66d2-8b4f2bd063f0@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.