x86/fpu/xstate: Warn when checking alignment of disabled xfeatures
An XSAVES component's alignment/offset is meaningful only when the feature is enabled. Return zero and WARN_ONCE on checking alignment of disabled features. Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lkml.kernel.org/r/20200109211452.27369-4-yu-cheng.yu@intel.com
This commit is contained in:
parent
49a91d61ae
commit
e70b100806
|
@ -325,6 +325,13 @@ static int xfeature_is_aligned(int xfeature_nr)
|
|||
u32 eax, ebx, ecx, edx;
|
||||
|
||||
CHECK_XFEATURE(xfeature_nr);
|
||||
|
||||
if (!xfeature_enabled(xfeature_nr)) {
|
||||
WARN_ONCE(1, "Checking alignment of disabled xfeature %d\n",
|
||||
xfeature_nr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx);
|
||||
/*
|
||||
* The value returned by ECX[1] indicates the alignment
|
||||
|
|
Loading…
Reference in New Issue