x86/sysctl: Fix NULL pointer dereference in error path
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Jan 2017 17:51:44 +0000 (17:51 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 13 Jan 2017 13:16:57 +0000 (13:16 +0000)
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 <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/sysctl.c

index 87da5418413b499666478f1685ee63ed914d8e10..b8c30d4c04b702b8557e083b65b526b9eafa3f04 100644 (file)
@@ -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,