Commit f0fe5108 authored by Avi Kivity's avatar Avi Kivity

KVM: Future-proof argument-less ioctls

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: default avatarAvi Kivity <avi@qumranet.com>
parent 07c45a36
...@@ -2169,6 +2169,9 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -2169,6 +2169,9 @@ static long kvm_vcpu_ioctl(struct file *filp,
switch (ioctl) { switch (ioctl) {
case KVM_RUN: case KVM_RUN:
r = -EINVAL;
if (arg)
goto out;
r = kvm_vcpu_ioctl_run(vcpu, vcpu->run); r = kvm_vcpu_ioctl_run(vcpu, vcpu->run);
break; break;
case KVM_GET_REGS: { case KVM_GET_REGS: {
...@@ -2440,9 +2443,15 @@ static long kvm_dev_ioctl(struct file *filp, ...@@ -2440,9 +2443,15 @@ static long kvm_dev_ioctl(struct file *filp,
switch (ioctl) { switch (ioctl) {
case KVM_GET_API_VERSION: case KVM_GET_API_VERSION:
r = -EINVAL;
if (arg)
goto out;
r = KVM_API_VERSION; r = KVM_API_VERSION;
break; break;
case KVM_CREATE_VM: case KVM_CREATE_VM:
r = -EINVAL;
if (arg)
goto out;
r = kvm_dev_ioctl_create_vm(); r = kvm_dev_ioctl_create_vm();
break; break;
case KVM_GET_MSR_INDEX_LIST: { case KVM_GET_MSR_INDEX_LIST: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment