Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jan Kara and committed by
Linus Torvalds
310ee9e8 8da53d45

+2
+2
lib/genalloc.c
··· 586 586 struct gen_pool **ptr, *pool; 587 587 588 588 ptr = devres_alloc(devm_gen_pool_release, sizeof(*ptr), GFP_KERNEL); 589 + if (!ptr) 590 + return NULL; 589 591 590 592 pool = gen_pool_create(min_alloc_order, nid); 591 593 if (pool) {