diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-05-02 21:50:51 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-05-02 21:50:51 +1000 |
commit | 24adf12722b4f2800e5b5f0955d57033f0d0c9e5 (patch) | |
tree | 3f9aee46f5d5fab937c03732e668735dde7663da /drivers/lguest/lguest_user.c | |
parent | 48e4043d4529523cbc7fa8dd745bd8e2c45ce1d3 (diff) | |
download | linux-24adf12722b4f2800e5b5f0955d57033f0d0c9e5.tar.gz linux-24adf12722b4f2800e5b5f0955d57033f0d0c9e5.tar.bz2 linux-24adf12722b4f2800e5b5f0955d57033f0d0c9e5.zip |
lguest: avoid using NR_CPUS as a bounds check.
NR_CPUS (being a host number) is an arbitrary limit for the Guest.
Using the array size directly (which currently happes to be NR_CPUS)
is more futureproof.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r-- | drivers/lguest/lguest_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 645e6e040bfb..4017701a1788 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. */ |