[PATCH] to select.c (and an apology)
willy en thepuffingroup.com
willy en thepuffingroup.com
Dom Ene 30 21:29:30 CST 2000
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);
> +*/
> +
> + fds = (struct pollfd **)kmalloc((nfds * sizeof(struct pollfd *))
> + / POLLFD_PER_PAGE, GFP_KERNEL);
hang on, this looks bad. the division will always round down, leaving
you with too little memory allocated (unless POLLFD_PER_PAGE exactly
divides nfds * sizeof(void *), which it probably does). you want to do
something like:
(nfds * sizeof(void *) + POLLFD_PER_PAGE - 1) / POLLFD_PER_PAGE
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Más información sobre la lista de distribución Ayuda