On 01/29/2018 10:09 AM, David Hildenbrand wrote: > On 25.01.2018 19:50, Ken Hofsass wrote: >> Replace hardcoded padding size value for struct kvm_sync_regs >> with #define SYNC_REGS_SIZE_BYTES. >> >> Also update the value specified in api.txt from outdated hardcoded >> value to SYNC_REGS_SIZE_BYTES. >> >> Signed-off-by: Ken Hofsass <hofsass@xxxxxxxxxx> Acked-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> >> --- >> Documentation/virtual/kvm/api.txt | 2 +- >> include/uapi/linux/kvm.h | 6 +++++- >> 2 files changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt >> index e5f1743e0b3e..de55fe173afe 100644 >> --- a/Documentation/virtual/kvm/api.txt >> +++ b/Documentation/virtual/kvm/api.txt >> @@ -3809,7 +3809,7 @@ in userspace. >> __u64 kvm_dirty_regs; >> union { >> struct kvm_sync_regs regs; >> - char padding[1024]; >> + char padding[SYNC_REGS_SIZE_BYTES]; >> } s; >> >> If KVM_CAP_SYNC_REGS is defined, these fields allow userspace to access >> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h >> index 62c564dd4aa1..e88ed6325e0e 100644 >> --- a/include/uapi/linux/kvm.h >> +++ b/include/uapi/linux/kvm.h >> @@ -396,6 +396,10 @@ struct kvm_run { >> char padding[256]; >> }; >> >> + /* 2048 is the size of the char array used to bound/pad the size >> + * of the union that holds sync regs. >> + */ >> + #define SYNC_REGS_SIZE_BYTES 2048 >> /* >> * shared registers between kvm and userspace. >> * kvm_valid_regs specifies the register classes set by the host >> @@ -407,7 +411,7 @@ struct kvm_run { >> __u64 kvm_dirty_regs; >> union { >> struct kvm_sync_regs regs; >> - char padding[2048]; >> + char padding[SYNC_REGS_SIZE_BYTES]; >> } s; >> }; >> >> > > Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> >