On Tue, Sep 9, 2008 at 9:42 AM, Oren Laadan <orenl@xxxxxxxxxxxxxxx> wrote: > + fdlist = kmalloc(max * sizeof(*fdlist), GFP_KERNEL); > + if (!fdlist) > + return -ENOMEM; > + > + spin_lock(&files->file_lock); > + fdt = files_fdtable(files); > + for (i = 0; i < fdt->max_fds; i++) { > + if (!fcheck_files(files, i)) > + continue; > + if (n == max) { > + /* fcheck_files() is safe with drop/re-acquire > + * of the lock, as it tests: fd < max_fds */ > + spin_unlock(&files->file_lock); > + max *= 2; > + if (max < 0) { /* overflow ? */ > + n = -EMFILE; > + goto out; > + } > + fdlist = krealloc(fdlist, max, GFP_KERNEL); Hm, shouldn't this be max * sizeof(*fdlist) like the kmalloc above? Vegard -- "The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers