Skip to content

Commit

Permalink
lib/genalloc.c: check result of devres_alloc()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jankara authored and torvalds committed Feb 14, 2015
1 parent 8da53d4 commit 310ee9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/genalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ struct gen_pool *devm_gen_pool_create(struct device *dev, int min_alloc_order,
struct gen_pool **ptr, *pool;

ptr = devres_alloc(devm_gen_pool_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return NULL;

pool = gen_pool_create(min_alloc_order, nid);
if (pool) {
Expand Down

0 comments on commit 310ee9e

Please sign in to comment.