{
unsigned int offset, size;
int i;
- u64 xfeatures;
u64 allowed_features;
struct xstate_header hdr;
size = sizeof(hdr);
memcpy(&hdr, kbuf + offset, size);
- xfeatures = hdr.xfeatures;
/*
* Reject if the user sets any disabled or supervisor features:
*/
allowed_features = xfeatures_mask & ~XFEATURE_MASK_SUPERVISOR;
- if (xfeatures & ~allowed_features)
+ if (hdr.xfeatures & ~allowed_features)
return -EINVAL;
for (i = 0; i < XFEATURE_MAX; i++) {
u64 mask = ((u64)1 << i);
- if (xfeatures & mask) {
+ if (hdr.xfeatures & mask) {
void *dst = __raw_xsave_addr(xsave, 1 << i);
offset = xstate_offsets[i];
}
}
- if (xfeatures_mxcsr_quirk(xfeatures)) {
+ if (xfeatures_mxcsr_quirk(hdr.xfeatures)) {
offset = offsetof(struct fxregs_state, mxcsr);
size = MXCSR_AND_FLAGS_SIZE;
memcpy(&xsave->i387.mxcsr, kbuf + offset, size);
/*
* Add back in the features that came in from userspace:
*/
- xsave->header.xfeatures |= xfeatures;
+ xsave->header.xfeatures |= hdr.xfeatures;
return 0;
}