From 2704c78aaa156e6843681ee344dd0ce75dbc63b2 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 11 Jan 2017 17:51:44 +0000 Subject: [PATCH] x86/sysctl: Fix NULL pointer dereference in error path This was introduced by c/s c38869e711 "x86/cpuid: Drop the temporary linear feature bitmap from struct cpuid_policy", and caught by Coverity. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/x86/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 87da541841..b8c30d4c04 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -230,8 +230,8 @@ long arch_do_sysctl( /* Bad featureset index? */ if ( !p ) ret = -EINVAL; - - cpuid_policy_to_featureset(p, featureset); + else + cpuid_policy_to_featureset(p, featureset); /* Copy the requested featureset into place. */ if ( !ret && copy_to_guest(sysctl->u.cpu_featureset.features, -- 2.30.2