main - bcache: fix incorrect pointer check
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=17802084c90df4ced26ae395292f0fc8466e72b7 Commit: 17802084c90df4ced26ae395292f0fc8466e72b7 Parent: d5f3239de4aa33f51cc8db7fc2e29db41cab9152 Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Mar 9 19:35:53 2021 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Mar 10 00:59:05 2021 +0100
bcache: fix incorrect pointer check
With commit b44db5d1a7ecc2e8e3cef0852c4397b64ddf0a09 needs to check allocated pointer for failed malloc().
Existing check was actually no checking anything so failing malloc here would result in segfault (although with very low chance to ever happen).
--- lib/device/bcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/device/bcache.c +1 -1
@@ -74,7 +74,7 @@ static struct cb_set *_cb_set_create(unsigned nr)unsigned i;struct cb_set *cbs =malloc (sizeof (*cbs) + nr *sizeof (*cbs->vec)); -if (!cbs->vec) +if (!cbs)return NULL ;dm_list_init (&cbs->free);