unsigned int order,
void **(*page_from)(void *, int))
{
- struct ptlrpc_page_pool *page_pool = page_pools[order];
+ struct ptlrpc_page_pool *page_pool;
wait_queue_entry_t waitlink;
unsigned long this_idle = -1;
u64 tick_ns = 0;
int p_idx, g_idx;
int i, rc = 0;
- if (!array || count <= 0 || count > page_pool->ppp_max_pages)
+ if (!array || count <= 0 || order >= POOLS_COUNT ||
+ count > page_pools[order]->ppp_max_pages)
return -EINVAL;
+ page_pool = page_pools[order];
spin_lock(&page_pool->ppp_lock);
page_pool->ppp_st_access++;
LASSERTF(order < POOLS_COUNT, "count %u, pool %u\n",
count, order);
- if (!array) {
+ if (!array || order >= POOLS_COUNT) {
CERROR("Faled to put %u pages, from pool %u\n",
count, order);
return -EINVAL;