]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu: Do not call g_strv_contains on NULL list
authorJiri Denemark <jdenemar@redhat.com>
Mon, 24 Feb 2025 10:24:27 +0000 (11:24 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 25 Feb 2025 08:35:26 +0000 (09:35 +0100)
When virCPUx86UpdateLive checks whether a feature was added to a CPU
model after the model was already released (vmx-* features in most Intel
models), the following assert could be logged by glib:

    g_strv_contains: assertion 'strv != NULL' failed

While most of our CPU models have a non-empty list of added feature, new
models added in 2024 and versioned variants of older models have
addedFeatures == NULL.

Fixes: e622970c8785ec1f7e142d72f792d89f870e07d0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/cpu/cpu_x86.c

index 67c88ae3b7afb1e4ed414eee70e42185837015fb..32aa01bc142c0638516a903647385fcf9d40aff0 100644 (file)
@@ -3212,6 +3212,7 @@ virCPUx86UpdateLive(virCPUDef *cpu,
          * behaved before the features were added.
          */
         if (!explicit &&
+            model->addedFeatures &&
             g_strv_contains((const char **) model->addedFeatures, feature->name))
             ignore = true;