int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask) 
int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask) 
int mempool_resize(mempool_t *pool, int new_min_nr, unsigned int __nocast gfp_mask){	void *element;	void **new_elements;	unsigned long flags;	BUG_ON(new_min_nr <= 0);	spin_lock_irqsave(&pool->lock, flags);	if (new_min_nr <= pool->min_nr) {		while (new_min_nr < pool->curr_nr) {			element = remove_element(pool);			spin_unlock_irqrestore(&pool->lock, flags);			pool->free(element, pool->pool_data);			spin_lock_irqsave(&pool->lock, flags);		}		pool->min_nr = new_min_nr;		goto out_unlock;	}	spin_unlock_irqrestore(&pool->lock, flags);	/* Grow the pool */	new_elements = kmalloc(new_min_nr * sizeof(*new_elements), gfp_mask);	if (!new_elements)		return -ENOMEM;	spin_lock_irqsave(&pool->lock, flags);	if (unlikely(new_min_nr <= pool->min_nr)) {		/* Raced, other resize will do our work */		spin_unlock_irqrestore(&pool->lock, flags);		kfree(new_elements);		goto out;	}	memcpy(new_elements, pool->elements,			pool->curr_nr * sizeof(*new_elements));	kfree(pool->elements);	pool->elements = new_elements;	pool->min_nr = new_min_nr;	while (pool->curr_nr < pool->min_nr) {		spin_unlock_irqrestore(&pool->lock, flags);		element = pool->alloc(gfp_mask, pool->pool_data);		if (!element)			goto out;		spin_lock_irqsave(&pool->lock, flags);		if (pool->curr_nr < pool->min_nr) {			add_element(pool, element);		} else {			spin_unlock_irqrestore(&pool->lock, flags);			pool->free(element, pool->pool_data);	/* Raced */			goto out;		}	}out_unlock:	spin_unlock_irqrestore(&pool->lock, flags);out:	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/dd0fc66fb33cd610bc1a5db8a5e232d34879b4d7/mempool.c/buggy/mm/mempool.c