Skip to content

Commit

Permalink
[PATCH] alloc_fdtable() expansion fix
Browse files Browse the repository at this point in the history
We're supposed to go the next power of two if nfds==nr.

Of `nr', not of `nfsd'.

Spotted by Rene Scharfe <[email protected]>

Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jul 12, 2006
1 parent ec572e3 commit a29b0b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static struct fdtable *alloc_fdtable(int nr)
if (!fdt)
goto out;

nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nfds));
nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nr + 1));
if (nfds > NR_OPEN)
nfds = NR_OPEN;

Expand Down

0 comments on commit a29b0b7

Please sign in to comment.