X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=drivers%2Flguest%2Flguest_user.c;h=e73a000473cc524cd16d9773da390047d362751e;hb=91d0322bef047e2916b3e52741411bffc63929cb;hp=564e425d71dd37747735e8ba47ed1b1881a022cb;hpb=a6bd8e13034dd7d60b6f14217096efa192d0adc1;p=linux-2.6 diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 564e425d71..e73a000473 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c @@ -102,7 +102,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) { /* We have a limited number the number of CPUs in the lguest struct. */ - if (id >= NR_CPUS) + if (id >= ARRAY_SIZE(cpu->lg->cpus)) return -EINVAL; /* Set up this CPU's id, and pointer back to the lguest struct. */ @@ -189,7 +189,7 @@ static int initialize(struct file *file, const unsigned long __user *input) } /* Populate the easy fields of our "struct lguest" */ - lg->mem_base = (void __user *)(long)args[0]; + lg->mem_base = (void __user *)args[0]; lg->pfn_limit = args[1]; /* This is the first cpu (cpu 0) and it will start booting at args[3] */ @@ -251,8 +251,6 @@ static ssize_t write(struct file *file, const char __user *in, if (!lg || (cpu_id >= lg->nr_cpus)) return -EINVAL; cpu = &lg->cpus[cpu_id]; - if (!cpu) - return -EINVAL; /* Once the Guest is dead, you can only read() why it died. */ if (lg->dead)