Skip to content

Commit c80e7a8

Browse files
rustyrussellLinus Torvalds
authored andcommitted
permit mempool_free(NULL)
Christian Borntraeger points out that mempool_free() doesn't noop when handed NULL. This is inconsistent with the other free-like functions in the kernel. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5e70030 commit c80e7a8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎mm/mempool.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ void mempool_free(void *element, mempool_t *pool)
263263
{
264264
unsigned long flags;
265265

266+
if (unlikely(element == NULL))
267+
return;
268+
266269
smp_mb();
267270
if (pool->curr_nr < pool->min_nr) {
268271
spin_lock_irqsave(&pool->lock, flags);

0 commit comments

Comments
 (0)