aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/compat.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/fs/compat.c b/fs/compat.c
index ef5a0771592d..7f8e26ea427c 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1639,15 +1639,6 @@ void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
1639 * This is a virtual copy of sys_select from fs/select.c and probably 1639 * This is a virtual copy of sys_select from fs/select.c and probably
1640 * should be compared to it from time to time 1640 * should be compared to it from time to time
1641 */ 1641 */
1642static void *select_bits_alloc(int size)
1643{
1644 return kmalloc(6 * size, GFP_KERNEL);
1645}
1646
1647static void select_bits_free(void *bits, int size)
1648{
1649 kfree(bits);
1650}
1651 1642
1652/* 1643/*
1653 * We can actually return ERESTARTSYS instead of EINTR, but I'd 1644 * 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 */ 1677 */
1687 ret = -ENOMEM; 1678 ret = -ENOMEM;
1688 size = FDS_BYTES(n); 1679 size = FDS_BYTES(n);
1689 bits = select_bits_alloc(size); 1680 bits = kmalloc(6 * size, GFP_KERNEL);
1690 if (!bits) 1681 if (!bits)
1691 goto out_nofds; 1682 goto out_nofds;
1692 fds.in = (unsigned long *) bits; 1683 fds.in = (unsigned long *) bits;
@@ -1720,7 +1711,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1720 compat_set_fd_set(n, exp, fds.res_ex); 1711 compat_set_fd_set(n, exp, fds.res_ex);
1721 1712
1722out: 1713out:
1723 select_bits_free(bits, size); 1714 kfree(bits);
1724out_nofds: 1715out_nofds:
1725 return ret; 1716 return ret;
1726} 1717}