Messages in this thread | | | Date | Mon, 31 Jan 2000 08:40:11 +0100 | From | almesber@lrc ... | Subject | Re: [PATCH] to select.c (and an apology) |
| |
willy@thepuffingroup.com wrote: > On Mon, Jan 31, 2000 at 03:56:03AM +0100, Patrick Mau wrote: >> +/* >> fds = (struct pollfd **)kmalloc( >> (1 + (nfds - 1) / POLLFD_PER_PAGE) * sizeof(struct pollfd *), >> GFP_KERNEL);
> (nfds * sizeof(void *) + POLLFD_PER_PAGE - 1) / POLLFD_PER_PAGE
Assuming that a struct pollfd * points to a page of pollfds, and fds is an array of pointers, this is still wrong, e.g. assume nfds = 1, sizeof(void *) = 4, POLLFD_PER_PAGE any value >= 2.
The original version yields a correct result and even seems a bit clearer, unless nfds-1 becomes unsigned. In that case, something like
(nfds+POLLFD_PER_PAGE-1)/POLLFD_PER_PAGE*sizeof(struct pollfd *)
should help.
- Werner
-- _________________________________________________________________________ / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch / /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
- 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/
| |