(FIXED) Re: [patchp chunk-allocation in poll(2) (for nfds>1600 poll problem fix)

From: Tigran Aivazian (tigran@ocston.org)
Date: Wed Jan 19 2000 - 06:52:03 EST


Dohhh.. I was blind :) Fixed now. Rsh works, everything else works etc.

http://www.ocston.org/~tigran/patches/pollfix.patch

The mistake was u - > (u+j) in teh loop over j.

Sorry about the bug but it was fun :)

cc'd Alan as I hope this is the last iteration of this patch.

Thanks,
Tigran.

On Wed, 19 Jan 2000, Tigran Aivazian wrote:

> Hi James,
>
> Thanks for your comments.
>
> There is a bug in this piece of code:
>
>
> /* OK, now copy the revents fields back to user space. */
> - fds1 = fds;
> - for(i=0; i < (int)nfds; i++, ufds++, fds1++) {
> - __put_user(fds1->revents, &ufds->revents);
> - }
> + u = ufds;
> + for(i=0; i < nchunks; i++, u += (i<<POLL_PER_CHUNK_BITS))
> + for (j=0; j < POLL_PER_CHUNK; j++)
> + __put_user((fds[i] + j)->revents, &u->revents);
> + u += (nchunks<<POLL_PER_CHUNK_BITS);
> + if (nleft)
> + for (j=0; j < nleft; j++)
> + __put_user((fds[nchunks] + j)->revents,
> &u->revents);
>
> can you spot it? I must be blind but I can't spot it immediately and it
> breaks rsh :( (because the wrong revents is copied, shifted by one)
>
> I can't spend any time debugging it at work so it will have to wait until
> evening...
>
> Regards,
> Tigran.
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:19 EST