Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80906
b: refs/heads/master
c: 7ea07a1
h: refs/heads/master
v: v3
  • Loading branch information
Glauber de Oliveira Costa authored and Rusty Russell committed Jan 30, 2008
1 parent 26ef044 commit 46349cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 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: d0953d42c3445a120299fac9ad70e672d77898e9
refs/heads/master: 7ea07a1500f05e06ebf0136763c781244f77a2a1
11 changes: 9 additions & 2 deletions trunk/drivers/lguest/lguest_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,21 @@ static ssize_t write(struct file *file, const char __user *in,
struct lguest *lg = file->private_data;
const unsigned long __user *input = (const unsigned long __user *)in;
unsigned long req;
struct lg_cpu *cpu;
unsigned int cpu_id = *off;

if (get_user(req, input) != 0)
return -EFAULT;
input++;

/* If you haven't initialized, you must do that first. */
if (req != LHREQ_INITIALIZE && !lg)
return -EINVAL;
if (req != LHREQ_INITIALIZE) {
if (!lg || (cpu_id >= lg->nr_cpus))
return -EINVAL;
cpu = &lg->cpus[cpu_id];
if (!cpu)
return -EINVAL;
}

/* Once the Guest is dead, all you can do is read() why it died. */
if (lg && lg->dead)
Expand Down

0 comments on commit 46349cb

Please sign in to comment.