x86/sysctl: Fix NULL pointer dereference in error path
PATCH 1/1 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.
---
CC: Jan Beulich <[email protected]>
--- xen/arch/x86/sysctl.c | 3 +++ 1 file changed, 3 insertions(+)
xen/arch/x86/sysctl.c +3 -0
@@ -229,7 +229,10 @@ long arch_do_sysctl(/* Bad featureset index? */ if ( !p ) + { ret = -EINVAL ; +break ; + }cpuid_policy_to_featureset (p, featureset);
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
xen/arch/x86/sysctl.c long arch_do_sysctl( · line 237
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 11.01.17 at 18:57, <[email protected]> wrote:
xen/arch/x86/sysctl.c +3
-0@@ -229,7 +229,10 @@ long arch_do_sysctl(/* Bad featureset index? */ if ( !p ) + { ret = -EINVAL ; +break ; + }cpuid_policy_to_featureset (p, featureset);
Considering how the following code is written, adding an "else" would seem more natural. With the patch above the !ret check right out of context would then be dead code. With either of the possible adjustments
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 11.01.17 at 18:57, <[email protected]> wrote:
xen/arch/x86/sysctl.c +3
-0@@ -229,7 +229,10 @@ long arch_do_sysctl(/* Bad featureset index? */ if ( !p ) + { ret = -EINVAL ; +break ; + }
Quoted 6 lines
xen/arch/x86/sysctl.c long arch_do_sysctl( · line 237
Quoted 1 line
xen/arch/x86/sysctl.c +0
-0cpuid_policy_to_featureset (p, featureset);Considering how the following code is written, adding an "else" would seem more natural. With the patch above the !ret check right out of context would then be dead code. With either of the possible adjustments
Reviewed-by Jan Beulich <[email protected]>
Good point - I will make that adjustment.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel