[ft-lib/bcache] alloc_block wasn't checking for an empty free list
This commit is contained in:
parent
0569e06e80
commit
09fa32a423
@ -444,8 +444,10 @@ static void exit_free_list(struct bcache *cache)
|
||||
|
||||
static struct block *alloc_block(struct bcache *cache)
|
||||
{
|
||||
struct block *b = container_of(list_pop(&cache->free), struct block, list);
|
||||
return b;
|
||||
if (list_empty(&cache->free))
|
||||
return NULL;
|
||||
|
||||
return container_of(list_pop(&cache->free), struct block, list);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user