Skip to contentSkip to conversation

Fix alloc_fdtable()

PATCH New OGAWA Hirofumi 1 participant 1 message Jul 11, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix alloc_fdtable()

Current logic seems wrong, the result is always "8 * L1_CACHE_BYTES". It's probably typo, we should use nr + 1' instead of nfds' here.

---

 fs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/file.c renamed from fs/file.c~alloc_fdtable-fix +1 -1
diff -puN fs/file.c~alloc_fdtable-fix fs/file.c
@@ -240,7 +240,7 @@ static struct fdtable *alloc_fdtable(int
 	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;
 

_

Signature · 1 line
OGAWA Hirofumi <[email protected]>