@@ -501,8 +501,12 @@ int xstate_alloc_save_area(struct vcpu *
unsigned int i;
for ( size = 0, i = 2; i < xstate_features; ++i )
+ {
+ if ( !(xfeature_mask & (1ul << i)) )
+ continue;
if ( size < xstate_size(i) )
size = xstate_size(i);
+ }
size += XSTATE_AREA_MIN_SIZE;
}
@@ -543,6 +547,8 @@ int xstate_update_save_area(struct vcpu
for ( size = old = XSTATE_AREA_MIN_SIZE, i = 2; i < xstate_features; ++i )
{
+ if ( !(xfeature_mask & (1ul << i)) )
+ continue;
if ( xcr0_max & (1ul << i) )
size = max(size, xstate_offset(i) + xstate_size(i));
if ( v->arch.xcr0_accum & (1ul << i) )
There's no point in including unsupported components in the size calculations of xstate_{alloc,update}_save_area(). Signed-off-by: Jan Beulich <jbeulich@suse.com>