aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lguest_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r--drivers/lguest/lguest_user.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 645e6e040bf..e73a000473c 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)
102static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) 102static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
103{ 103{
104 /* We have a limited number the number of CPUs in the lguest struct. */ 104 /* We have a limited number the number of CPUs in the lguest struct. */
105 if (id >= NR_CPUS) 105 if (id >= ARRAY_SIZE(cpu->lg->cpus))
106 return -EINVAL; 106 return -EINVAL;
107 107
108 /* Set up this CPU's id, and pointer back to the lguest struct. */ 108 /* Set up this CPU's id, and pointer back to the lguest struct. */
@@ -251,8 +251,6 @@ static ssize_t write(struct file *file, const char __user *in,
251 if (!lg || (cpu_id >= lg->nr_cpus)) 251 if (!lg || (cpu_id >= lg->nr_cpus))
252 return -EINVAL; 252 return -EINVAL;
253 cpu = &lg->cpus[cpu_id]; 253 cpu = &lg->cpus[cpu_id];
254 if (!cpu)
255 return -EINVAL;
256 254
257 /* Once the Guest is dead, you can only read() why it died. */ 255 /* Once the Guest is dead, you can only read() why it died. */
258 if (lg->dead) 256 if (lg->dead)