diff options
author | Jan Kara <jack@suse.cz> | 2015-02-13 17:36:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:36 -0500 |
commit | 310ee9e8f370f8fd7a76856726aea88839bb0f8f (patch) | |
tree | e1cb008a16a701566c81f89ad4d68cc714b34381 /lib | |
parent | 8da53d4595a53fb9a3380dd4d1c9bc24c7c9aab8 (diff) |
lib/genalloc.c: check result of devres_alloc()
devm_gen_pool_create() calls devres_alloc() and dereferences its result
without checking whether devres_alloc() succeeded. Check for error and
bail out if it happened.
Coverity-id 1016493.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/genalloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c index 0fe1cbe87700..d214866eeea2 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -586,6 +586,8 @@ struct gen_pool *devm_gen_pool_create(struct device *dev, int min_alloc_order, | |||
586 | struct gen_pool **ptr, *pool; | 586 | struct gen_pool **ptr, *pool; |
587 | 587 | ||
588 | ptr = devres_alloc(devm_gen_pool_release, sizeof(*ptr), GFP_KERNEL); | 588 | ptr = devres_alloc(devm_gen_pool_release, sizeof(*ptr), GFP_KERNEL); |
589 | if (!ptr) | ||
590 | return NULL; | ||
589 | 591 | ||
590 | pool = gen_pool_create(min_alloc_order, nid); | 592 | pool = gen_pool_create(min_alloc_order, nid); |
591 | if (pool) { | 593 | if (pool) { |