Commit 68c3431a authored by Vadim Lobanov's avatar Vadim Lobanov Committed by Linus Torvalds

[PATCH] Fold select_bits_alloc/free into caller code.

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: default avatarVadim Lobanov <vlobanov@speakeasy.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e4a1f129
...@@ -1639,15 +1639,6 @@ void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, ...@@ -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 * This is a virtual copy of sys_select from fs/select.c and probably
* should be compared to it from time to time * 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 * We can actually return ERESTARTSYS instead of EINTR, but I'd
...@@ -1686,7 +1677,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp, ...@@ -1686,7 +1677,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
*/ */
ret = -ENOMEM; ret = -ENOMEM;
size = FDS_BYTES(n); size = FDS_BYTES(n);
bits = select_bits_alloc(size); bits = kmalloc(6 * size, GFP_KERNEL);
if (!bits) if (!bits)
goto out_nofds; goto out_nofds;
fds.in = (unsigned long *) bits; fds.in = (unsigned long *) bits;
...@@ -1720,7 +1711,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp, ...@@ -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); compat_set_fd_set(n, exp, fds.res_ex);
out: out:
select_bits_free(bits, size); kfree(bits);
out_nofds: out_nofds:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment