Commit ab322c4
committed
KVM: x86: Update number of entries for KVM_GET_CPUID2 on success, not failure
Update cpuid->nent if and only if kvm_vcpu_ioctl_get_cpuid2() succeeds.
The sole caller copies @CpuID to userspace only on success, i.e. the
existing code effectively does nothing.
Arguably, KVM should report the number of entries when returning -E2BIG so
that userspace doesn't have to guess the size, but all other similar KVM
ioctls() don't report the size either, i.e. userspace is conditioned to
guess.
Suggested-by: Takahiro Itazuri <itazur@amazon.com>
Link: https://lore.kernel.org/all/20230410141820.57328-1-itazur@amazon.com
Link: https://lore.kernel.org/r/20230526210340.2799158-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 0d42522 commit ab322c4
1 file changed
Lines changed: 4 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | 504 | | |
508 | | - | |
509 | | - | |
| 505 | + | |
| 506 | + | |
510 | 507 | | |
511 | 508 | | |
512 | | - | |
513 | | - | |
| 509 | + | |
514 | 510 | | |
515 | | - | |
516 | 511 | | |
517 | | - | |
| 512 | + | |
518 | 513 | | |
519 | 514 | | |
520 | 515 | | |
| |||
0 commit comments