Re: [PATCH 04/16] per-cpu run guest

2008-01-08 Thread Rusty Russell
On Tuesday 08 January 2008 00:05:25 Glauber de Oliveira Costa wrote:
> + /* Watch out for arbitrary vcpu indexes! */
> + if (vcpu_id > lg->nr_vcpus)
> + return -EINVAL;
> +
> + vcpu = &lg->vcpus[vcpu_id];
> +

Out-by-one error here... Fixed it for you, plus a couple of others.

I've applied the patches, but made one minor-but-invasive change: I didn't 
want to ask you to spin the patches again!

I changed "vcpu" to "cpu" everywhere (the v is pretty redundant in this 
context), which cut about a dozen lines of code out (things now fitted 
again!).

I also changed "vcpu_id" to simply "id" and made it unsigned.  Do you plan for 
this to always be equal to the index in the vcpu array BTW?  If so, we can 
neaten vcpu_start (now lg_cpu_start)...

You can grab the latest now...

Thanks!
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 04/16] per-cpu run guest

2007-12-25 Thread Rusty Russell
On Friday 21 December 2007 00:33:44 Glauber de Oliveira Costa wrote:
> @@ -55,11 +55,15 @@ static int user_send_irq(struct lguest *lg, const
> unsigned long __user *input) static ssize_t read(struct file *file, char
> __user *user, size_t size,loff_t*o) {
>   struct lguest *lg = file->private_data;
> + struct lguest_vcpu *vcpu = NULL;
> + unsigned int vcpu_id = *o;
>
>   /* You must write LHREQ_INITIALIZE first! */
>   if (!lg)
>   return -EINVAL;
>
> + vcpu = &lg->vcpus[vcpu_id];
> +

Better do a bounds check here!

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/