[PATCH] cpu: Do not call g_strv_contains on NULL list

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> --- src/cpu/cpu_x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 67c88ae3b7..32aa01bc14 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -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; -- 2.48.1

On 2/24/25 15:22, Jiri Denemark wrote:
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> --- src/cpu/cpu_x86.c | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Jiri Denemark
-
Michal Prívozník