mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
dm cache: fix error return code in cache_create
Return -ENOMEM if memory allocation fails in cache_create instead of 0 (to avoid NULL pointer dereference). Signed-off-by: Wei Yongjun <[email protected]> Cc: [email protected] Signed-off-by: Alasdair G Kergon <[email protected]>
This commit is contained in:
parent
d793e68427
commit
fa4d683af3
1 changed files with 1 additions and 0 deletions
|
|
@ -1971,6 +1971,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
|
|||
atomic_set(&cache->nr_migrations, 0);
|
||||
init_waitqueue_head(&cache->migration_wait);
|
||||
|
||||
r = -ENOMEM;
|
||||
cache->nr_dirty = 0;
|
||||
cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size));
|
||||
if (!cache->dirty_bitset) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue