All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free()
@ 2005-10-06 15:20 Alexey Dobriyan
  2005-10-07 22:59 ` Arthur Othieno
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-10-06 15:20 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

* Both are trivial wrappers.
* Each wrapper is used only in one place.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/select.c |   14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

--- ./fs/select.c
+++ ./fs/select.c
@@ -274,16 +274,6 @@ int do_select(int n, fd_set_bits *fds, l
 	return retval;
 }
 
-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
  * like to be certain this leads to no problems. So I return
@@ -344,7 +334,7 @@ sys_select(int n, fd_set __user *inp, fd
 	 */
 	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;
@@ -390,7 +380,7 @@ sys_select(int n, fd_set __user *inp, fd
 		ret = -EFAULT;
 
 out:
-	select_bits_free(bits, size);
+	kfree(bits);
 out_nofds:
 	return ret;
 }


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free()
  2005-10-06 15:20 [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free() Alexey Dobriyan
@ 2005-10-07 22:59 ` Arthur Othieno
  2005-10-08 22:16 ` Arthur Othieno
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Arthur Othieno @ 2005-10-07 22:59 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

On Thu, Oct 06, 2005 at 07:20:16PM +0400, Alexey Dobriyan wrote:
> * Both are trivial wrappers.
> * Each wrapper is used only in one place.

These managed to stay under you radar :)

fs/compat.c:1597:static void *select_bits_alloc(int size)
fs/compat.c:1602:static void select_bits_free(void *bits, int size)
fs/compat.c:1666:	bits = select_bits_alloc(size);
fs/compat.c:1712:	select_bits_free(bits, size);

Also, comment above select_bits_alloc() definition needs relocation to
right above compat_sys_select().

	Arthur

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free()
  2005-10-06 15:20 [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free() Alexey Dobriyan
  2005-10-07 22:59 ` Arthur Othieno
@ 2005-10-08 22:16 ` Arthur Othieno
  2005-10-08 22:17 ` Alexey Dobriyan
  2005-10-08 23:26 ` Alexey Dobriyan
  3 siblings, 0 replies; 5+ messages in thread
From: Arthur Othieno @ 2005-10-08 22:16 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On Sun, Oct 09, 2005 at 02:17:06AM +0400, Alexey Dobriyan wrote:
> On Fri, Oct 07, 2005 at 06:59:11PM -0400, Arthur Othieno wrote:
> > On Thu, Oct 06, 2005 at 07:20:16PM +0400, Alexey Dobriyan wrote:
> > > * Both are trivial wrappers.
> > > * Each wrapper is used only in one place.
> >
> > These managed to stay under you radar :)
> 
> Heh... Who greps for static functions? ;-)
> 
> > fs/compat.c:1597:static void *select_bits_alloc(int size)
> > fs/compat.c:1602:static void select_bits_free(void *bits, int size)
> > fs/compat.c:1666:	bits = select_bits_alloc(size);
> > fs/compat.c:1712:	select_bits_free(bits, size);
> 
> So, 2 ways: remove all, consolidate. Opinions?

As you noted earlier, these are pretty much redundant (across both
fs/{compat,select}.c). Removing all would be a better cleanup, no?

	Arthur

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free()
  2005-10-06 15:20 [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free() Alexey Dobriyan
  2005-10-07 22:59 ` Arthur Othieno
  2005-10-08 22:16 ` Arthur Othieno
@ 2005-10-08 22:17 ` Alexey Dobriyan
  2005-10-08 23:26 ` Alexey Dobriyan
  3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-10-08 22:17 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

On Fri, Oct 07, 2005 at 06:59:11PM -0400, Arthur Othieno wrote:
> On Thu, Oct 06, 2005 at 07:20:16PM +0400, Alexey Dobriyan wrote:
> > * Both are trivial wrappers.
> > * Each wrapper is used only in one place.
>
> These managed to stay under you radar :)

Heh... Who greps for static functions? ;-)

> fs/compat.c:1597:static void *select_bits_alloc(int size)
> fs/compat.c:1602:static void select_bits_free(void *bits, int size)
> fs/compat.c:1666:	bits = select_bits_alloc(size);
> fs/compat.c:1712:	select_bits_free(bits, size);

So, 2 ways: remove all, consolidate. Opinions?


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free()
  2005-10-06 15:20 [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free() Alexey Dobriyan
                   ` (2 preceding siblings ...)
  2005-10-08 22:17 ` Alexey Dobriyan
@ 2005-10-08 23:26 ` Alexey Dobriyan
  3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-10-08 23:26 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

* Both are trivial wrappers.
* Each wrapper is used only in one place.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/compat.c |   13 ++-----------
 fs/select.c |   14 ++------------
 2 files changed, 4 insertions(+), 23 deletions(-)

Index: linux-kj/fs/select.c
===================================================================
--- linux-kj.orig/fs/select.c	2005-10-07 17:52:20.000000000 +0400
+++ linux-kj/fs/select.c	2005-10-09 03:14:45.000000000 +0400
@@ -274,16 +274,6 @@ int do_select(int n, fd_set_bits *fds, l
 	return retval;
 }
 
-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
  * like to be certain this leads to no problems. So I return
@@ -344,7 +334,7 @@ sys_select(int n, fd_set __user *inp, fd
 	 */
 	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;
@@ -390,7 +380,7 @@ sys_select(int n, fd_set __user *inp, fd
 		ret = -EFAULT;
 
 out:
-	select_bits_free(bits, size);
+	kfree(bits);
 out_nofds:
 	return ret;
 }
Index: linux-kj/fs/compat.c
===================================================================
--- linux-kj.orig/fs/compat.c	2005-10-07 17:52:20.000000000 +0400
+++ linux-kj/fs/compat.c	2005-10-09 03:18:02.000000000 +0400
@@ -1594,15 +1594,6 @@ void compat_set_fd_set(unsigned long nr,
  * 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
@@ -1663,7 +1654,7 @@ compat_sys_select(int n, compat_ulong_t 
 	 */
 	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;
@@ -1709,7 +1700,7 @@ compat_sys_select(int n, compat_ulong_t 
 	compat_set_fd_set(n, exp, fds.res_ex);
 
 out:
-	select_bits_free(bits, size);
+	kfree(bits);
 out_nofds:
 	return ret;
 }


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-08 23:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-06 15:20 [KJ] [PATCH] Remove select_bits_alloc(), select_bits_free() Alexey Dobriyan
2005-10-07 22:59 ` Arthur Othieno
2005-10-08 22:16 ` Arthur Othieno
2005-10-08 22:17 ` Alexey Dobriyan
2005-10-08 23:26 ` Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.