[lvm-devel] master - [device/bcache] fix bug in _alloc_block
David Teigland
teigland at sourceware.org
Mon Apr 23 13:47:07 UTC 2018
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19647d1cd44d029a8aa2f7e74dbdbd1f114a8c08
Commit: 19647d1cd44d029a8aa2f7e74dbdbd1f114a8c08
Parent: 1563b936911d26c665b590f200884c9ed31ab7c3
Author: Joe Thornber <ejt at redhat.com>
AuthorDate: Fri Feb 2 14:34:45 2018 +0000
Committer: David Teigland <teigland at redhat.com>
CommitterDate: Fri Apr 20 11:12:50 2018 -0500
[device/bcache] fix bug in _alloc_block
---
lib/device/bcache.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 4283ce5..e5d0e1b 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -449,8 +449,10 @@ static void _exit_free_list(struct bcache *cache)
static struct block *_alloc_block(struct bcache *cache)
{
- struct block *b = dm_list_struct_base(_list_pop(&cache->free), struct block, list);
- return b;
+ if (dm_list_empty(&cache->free))
+ return NULL;
+
+ return dm_list_struct_base(_list_pop(&cache->free), struct block, list);
}
/*----------------------------------------------------------------
More information about the lvm-devel
mailing list