Skip to content

Commit

Permalink
[PATCH] Fold select_bits_alloc/free into caller code.
Browse files Browse the repository at this point in the history
Remove an unnecessary level of indirection in allocating and freeing select
bits, as per the select_bits_alloc() and select_bits_free() functions.
Both select.c and compat.c are updated.

Signed-off-by: Vadim Lobanov <vlobanov@speakeasy.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Vadim Lobanov authored and Linus Torvalds committed Mar 28, 2006
1 parent e4a1f12 commit 68c3431
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,15 +1639,6 @@ void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
* This is a virtual copy of sys_select from fs/select.c and probably
* should be compared to it from time to time
*/
static void *select_bits_alloc(int size)
{
return kmalloc(6 * size, GFP_KERNEL);
}

static void select_bits_free(void *bits, int size)
{
kfree(bits);
}

/*
* We can actually return ERESTARTSYS instead of EINTR, but I'd
Expand Down Expand Up @@ -1686,7 +1677,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
*/
ret = -ENOMEM;
size = FDS_BYTES(n);
bits = select_bits_alloc(size);
bits = kmalloc(6 * size, GFP_KERNEL);
if (!bits)
goto out_nofds;
fds.in = (unsigned long *) bits;
Expand Down Expand Up @@ -1720,7 +1711,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
compat_set_fd_set(n, exp, fds.res_ex);

out:
select_bits_free(bits, size);
kfree(bits);
out_nofds:
return ret;
}
Expand Down

0 comments on commit 68c3431

Please sign in to comment.