Re: [PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Jesper Juhl
On Fri, 8 Apr 2005, Andrew Morton wrote:

> Jesper Juhl <[EMAIL PROTECTED]> wrote:
> >
> > 
> > General rule (as I understand it) is that functions that free resources 
> > should handle being passed NULL pointers - mempool_destroy() will 
> > currently explode if passed a NULL pointer, the patch below makes it safe 
> > to pass it NULL.
> 
> The best response to mempool_destroy(0) is an oops.  There's no legitimate
> reason for doing it.
> 
Ok, ignore the patch then.

-- 
Jesper


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Andrew Morton
Jesper Juhl <[EMAIL PROTECTED]> wrote:
>
> 
> General rule (as I understand it) is that functions that free resources 
> should handle being passed NULL pointers - mempool_destroy() will 
> currently explode if passed a NULL pointer, the patch below makes it safe 
> to pass it NULL.

The best response to mempool_destroy(0) is an oops.  There's no legitimate
reason for doing it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Jesper Juhl

General rule (as I understand it) is that functions that free resources 
should handle being passed NULL pointers - mempool_destroy() will 
currently explode if passed a NULL pointer, the patch below makes it safe 
to pass it NULL.

Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
---

 mempool.c |2 ++
 1 files changed, 2 insertions(+)


--- linux-2.6.12-rc2-mm2-orig/mm/mempool.c  2005-04-05 21:21:56.0 
+0200
+++ linux-2.6.12-rc2-mm2/mm/mempool.c   2005-04-09 03:33:58.0 +0200
@@ -176,6 +176,8 @@ EXPORT_SYMBOL(mempool_resize);
  */
 void mempool_destroy(mempool_t *pool)
 {
+   if (!pool)
+   return;
if (pool->curr_nr != pool->min_nr)
BUG();  /* There were outstanding elements */
free_pool(pool);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Jesper Juhl

General rule (as I understand it) is that functions that free resources 
should handle being passed NULL pointers - mempool_destroy() will 
currently explode if passed a NULL pointer, the patch below makes it safe 
to pass it NULL.

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
---

 mempool.c |2 ++
 1 files changed, 2 insertions(+)


--- linux-2.6.12-rc2-mm2-orig/mm/mempool.c  2005-04-05 21:21:56.0 
+0200
+++ linux-2.6.12-rc2-mm2/mm/mempool.c   2005-04-09 03:33:58.0 +0200
@@ -176,6 +176,8 @@ EXPORT_SYMBOL(mempool_resize);
  */
 void mempool_destroy(mempool_t *pool)
 {
+   if (!pool)
+   return;
if (pool-curr_nr != pool-min_nr)
BUG();  /* There were outstanding elements */
free_pool(pool);


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Andrew Morton
Jesper Juhl [EMAIL PROTECTED] wrote:

 
 General rule (as I understand it) is that functions that free resources 
 should handle being passed NULL pointers - mempool_destroy() will 
 currently explode if passed a NULL pointer, the patch below makes it safe 
 to pass it NULL.

The best response to mempool_destroy(0) is an oops.  There's no legitimate
reason for doing it.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make mempool_destroy resilient against NULL pointers.

2005-04-08 Thread Jesper Juhl
On Fri, 8 Apr 2005, Andrew Morton wrote:

 Jesper Juhl [EMAIL PROTECTED] wrote:
 
  
  General rule (as I understand it) is that functions that free resources 
  should handle being passed NULL pointers - mempool_destroy() will 
  currently explode if passed a NULL pointer, the patch below makes it safe 
  to pass it NULL.
 
 The best response to mempool_destroy(0) is an oops.  There's no legitimate
 reason for doing it.
 
Ok, ignore the patch then.

-- 
Jesper


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/