[PATCH 2/3] spufs: fix another off-by-one bug in mbox_read

Pekka Enberg penberg at cs.helsinki.fi
Wed Oct 25 04:42:06 EST 2006


Hi Arnd,

On 10/24/06, Arnd Bergmann <arnd at arndb.de> wrote:
>         spu_acquire(ctx);
> -       for (count = 0; count <= len; count += 4, udata++) {
> +       for (count = 0; (count + 4) <= len; count += 4, udata++) {

Wouldn't this be more obvious as

  for (count = 0, count < (len / 4); count++, udata++) {

And then do count * 4 if you need the actual index somewhere. Hmm?



More information about the Linuxppc-dev mailing list