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:39:36 EST


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:20 EST