* [PATCH] genalloc: Check result of devres_alloc()
@ 2015-01-21 12:45 Jan Kara
0 siblings, 0 replies; only message in thread
From: Jan Kara @ 2015-01-21 12:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Jan Kara
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>
---
lib/genalloc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 2e65d206b01c..094f8bee021f 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -587,6 +587,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) {
--
2.1.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-21 12:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 12:45 [PATCH] genalloc: Check result of devres_alloc() Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®