Skip to content

Commit

Permalink
KVM: Future-proof argument-less ioctls
Browse files Browse the repository at this point in the history
Some ioctls ignore their arguments.  By requiring them to be zero now,
we allow a nonzero value to have some special meaning in the future.

Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
avikivity committed May 3, 2007
1 parent 07c45a3 commit f0fe510
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,9 @@ static long kvm_vcpu_ioctl(struct file *filp,

switch (ioctl) {
case KVM_RUN:
r = -EINVAL;
if (arg)
goto out;
r = kvm_vcpu_ioctl_run(vcpu, vcpu->run);
break;
case KVM_GET_REGS: {
Expand Down Expand Up @@ -2440,9 +2443,15 @@ static long kvm_dev_ioctl(struct file *filp,

switch (ioctl) {
case KVM_GET_API_VERSION:
r = -EINVAL;
if (arg)
goto out;
r = KVM_API_VERSION;
break;
case KVM_CREATE_VM:
r = -EINVAL;
if (arg)
goto out;
r = kvm_dev_ioctl_create_vm();
break;
case KVM_GET_MSR_INDEX_LIST: {
Expand Down

0 comments on commit f0fe510

Please sign in to comment.