Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] alloc_fdtable() expansion fix

We're supposed to go the next power of two if nfds==nr.

Of `nr', not of `nfsd'.

Spotted by Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andrew Morton and committed by
Linus Torvalds
a29b0b74 ec572e3f

+1 -1
+1 -1
fs/file.c
··· 240 240 if (!fdt) 241 241 goto out; 242 242 243 - nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nfds)); 243 + nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nr + 1)); 244 244 if (nfds > NR_OPEN) 245 245 nfds = NR_OPEN; 246 246