Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25508
b: refs/heads/master
c: b04eb6a
h: refs/heads/master
v: v3
  • Loading branch information
Mitchell Blank Jr authored and Linus Torvalds committed Apr 11, 2006
1 parent 10d91b8 commit 92c3c25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9cdf410ca8f59b52bc7061a6751050010c7cc5b
refs/heads/master: b04eb6aa08ecc3e24df2f78ebc486011ebd74feb
16 changes: 9 additions & 7 deletions trunk/fs/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
{
fd_set_bits fds;
void *bits;
int ret, size, max_fdset;
int ret, max_fdset;
unsigned int size;
struct fdtable *fdt;
/* Allocate small arguments on the stack to save memory and be faster */
long stack_fds[SELECT_STACK_ALLOC/sizeof(long)];
Expand All @@ -333,14 +334,15 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
* since we used fdset we need to allocate memory in units of
* long-words.
*/
ret = -ENOMEM;
size = FDS_BYTES(n);
if (6*size < SELECT_STACK_ALLOC)
bits = stack_fds;
else
bits = stack_fds;
if (size > sizeof(stack_fds) / 6) {
/* Not enough space in on-stack array; must use kmalloc */
ret = -ENOMEM;
bits = kmalloc(6 * size, GFP_KERNEL);
if (!bits)
goto out_nofds;
if (!bits)
goto out_nofds;
}
fds.in = bits;
fds.out = bits + size;
fds.ex = bits + 2*size;
Expand Down

0 comments on commit 92c3c25

Please sign in to comment.