Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93815
b: refs/heads/master
c: 3e4bb3a
h: refs/heads/master
i:
  93813: 355930e
  93811: 830b004
  93807: 09d9b95
v: v3
  • Loading branch information
Xiantao Zhang authored and Avi Kivity committed Apr 27, 2008
1 parent 0778a0c commit a107e93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d3ad1f40c841bd3e97d30d423eea53915d085dc
refs/heads/master: 3e4bb3ac9e0ada5df5f6729648d403ea9f071d10
33 changes: 22 additions & 11 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,28 +852,39 @@ static long kvm_vcpu_ioctl(struct file *filp,
r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);
break;
case KVM_GET_REGS: {
struct kvm_regs kvm_regs;
struct kvm_regs *kvm_regs;

memset(&kvm_regs, 0, sizeof kvm_regs);
r = kvm_arch_vcpu_ioctl_get_regs(vcpu, &kvm_regs);
if (r)
r = -ENOMEM;
kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL);
if (!kvm_regs)
goto out;
r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs);
if (r)
goto out_free1;
r = -EFAULT;
if (copy_to_user(argp, &kvm_regs, sizeof kvm_regs))
goto out;
if (copy_to_user(argp, kvm_regs, sizeof(struct kvm_regs)))
goto out_free1;
r = 0;
out_free1:
kfree(kvm_regs);
break;
}
case KVM_SET_REGS: {
struct kvm_regs kvm_regs;
struct kvm_regs *kvm_regs;

r = -EFAULT;
if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs))
r = -ENOMEM;
kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL);
if (!kvm_regs)
goto out;
r = kvm_arch_vcpu_ioctl_set_regs(vcpu, &kvm_regs);
r = -EFAULT;
if (copy_from_user(kvm_regs, argp, sizeof(struct kvm_regs)))
goto out_free2;
r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs);
if (r)
goto out;
goto out_free2;
r = 0;
out_free2:
kfree(kvm_regs);
break;
}
case KVM_GET_SREGS: {
Expand Down

0 comments on commit a107e93

Please sign in to comment.