[libvirt] [PATCH 05/36] cpu_x86: Require <cpuid> within <feature> in CPU map

Jiri Denemark posted 36 patches 6 years, 10 months ago
[libvirt] [PATCH 05/36] cpu_x86: Require <cpuid> within <feature> in CPU map
Posted by Jiri Denemark 6 years, 10 months ago
A feature with no cpuid element is invalid and it should not be silently
treated as a feature with all CPUID bits set to zero.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu/cpu_x86.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 3b87386270..3a8e3dd37f 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -924,6 +924,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
     if (n < 0)
         goto cleanup;
 
+    if (n == 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Missing cpuid for feature %s"),
+                       feature->name);
+        goto cleanup;
+    }
+
     for (i = 0; i < n; i++) {
         ctxt->node = nodes[i];
         if (x86ParseCPUID(ctxt, &cpuid) < 0) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/36] cpu_x86: Require <cpuid> within <feature> in CPU map
Posted by Ján Tomko 6 years, 10 months ago
On Mon, Apr 08, 2019 at 10:42:09AM +0200, Jiri Denemark wrote:
>A feature with no cpuid element is invalid and it should not be silently
>treated as a feature with all CPUID bits set to zero.
>
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/cpu/cpu_x86.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/36] cpu_x86: Require <cpuid> within <feature> in CPU map
Posted by Jiri Denemark 6 years, 10 months ago
On Mon, Apr 08, 2019 at 14:31:53 +0200, Ján Tomko wrote:
> On Mon, Apr 08, 2019 at 10:42:09AM +0200, Jiri Denemark wrote:
> >A feature with no cpuid element is invalid and it should not be silently
> >treated as a feature with all CPUID bits set to zero.
> >
> >Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> >---
> > src/cpu/cpu_x86.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> 
> Reviewed-by: Ján Tomko <jtomko@redhat.com>

Hmm, I realized I didn't do a good job in ordering the first few patches
in this series as patches 1, 4, and 5 are quite unrelated to the
refactoring and MSR features. I'll just push them while waiting for
reviews for the rest of the series.

Thanks, Jirka.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list