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.
Unified · Split
| @@ -3905,7 +3905,7 @@ in userspace. · 3904 unmodified lines | ||
| 3905 | 3905 | __u64 kvm_dirty_regs; |
| 3906 | 3906 | union { |
| 3907 | 3907 | struct kvm_sync_regs regs; |
| 3908 | − char padding[1024]; | |
| 3908 | + char padding[SYNC_REGS_SIZE_BYTES]; | |
| 3909 | 3909 | } s; |
| 3910 | 3910 | |
| 3911 | 3911 | If KVM_CAP_SYNC_REGS is defined, these fields allow userspace to access |
| @@ -396,6 +396,10 @@ struct kvm_run { · 395 unmodified lines | ||
| 396 | 396 | char padding[256]; |
| 397 | 397 | }; |
| 398 | 398 | |
| 399 | + /* 2048 is the size of the char array used to bound/pad the size | |
| 400 | + * of the union that holds sync regs. | |
| 401 | + */ | |
| 402 | + #define SYNC_REGS_SIZE_BYTES 2048 | |
| 399 | 403 | /* |
| 400 | 404 | * shared registers between kvm and userspace. |
| 401 | 405 | * kvm_valid_regs specifies the register classes set by the host |
| @@ -407,7 +411,7 @@ struct kvm_run { · 5 unmodified lines | ||
| 407 | 411 | __u64 kvm_dirty_regs; |
| 408 | 412 | union { |
| 409 | 413 | struct kvm_sync_regs regs; |
| 410 | − char padding[2048]; | |
| 414 | + char padding[SYNC_REGS_SIZE_BYTES]; | |
| 411 | 415 | } s; |
| 412 | 416 | }; |
| 413 | 417 | |