From: kbuild test robot <lkp@intel.com>
To: Xidong Wang <wangxidong_97@163.com>
Cc: kbuild-all@01.org, Andrew Morton <akpm@linux-foundation.org>,
Vitaly Wool <vitalywool@gmail.com>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] z3fold: fix memory leak
Date: Thu, 5 Apr 2018 22:57:26 +0800 [thread overview]
Message-ID: <201804052205.ejzdZ5Qg%fengguang.wu@intel.com> (raw)
In-Reply-To: <1522803111-29209-1-git-send-email-wangxidong_97@163.com>
Hi Xidong,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.16 next-20180405]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Xidong-Wang/z3fold-fix-memory-leak/20180404-114952
base: git://git.cmpxchg.org/linux-mmotm.git master
smatch warnings:
mm/z3fold.c:493 z3fold_create_pool() error: potential null dereference 'pool'. (kzalloc returns null)
mm/z3fold.c:493 z3fold_create_pool() error: we previously assumed 'pool' could be null (see line 465)
vim +/pool +493 mm/z3fold.c
443
444
445 /*
446 * API Functions
447 */
448
449 /**
450 * z3fold_create_pool() - create a new z3fold pool
451 * @name: pool name
452 * @gfp: gfp flags when allocating the z3fold pool structure
453 * @ops: user-defined operations for the z3fold pool
454 *
455 * Return: pointer to the new z3fold pool or NULL if the metadata allocation
456 * failed.
457 */
458 static struct z3fold_pool *z3fold_create_pool(const char *name, gfp_t gfp,
459 const struct z3fold_ops *ops)
460 {
461 struct z3fold_pool *pool = NULL;
462 int i, cpu;
463
464 pool = kzalloc(sizeof(struct z3fold_pool), gfp);
> 465 if (!pool)
466 goto out;
467 spin_lock_init(&pool->lock);
468 spin_lock_init(&pool->stale_lock);
469 pool->unbuddied = __alloc_percpu(sizeof(struct list_head)*NCHUNKS, 2);
470 for_each_possible_cpu(cpu) {
471 struct list_head *unbuddied =
472 per_cpu_ptr(pool->unbuddied, cpu);
473 for_each_unbuddied_list(i, 0)
474 INIT_LIST_HEAD(&unbuddied[i]);
475 }
476 INIT_LIST_HEAD(&pool->lru);
477 INIT_LIST_HEAD(&pool->stale);
478 atomic64_set(&pool->pages_nr, 0);
479 pool->name = name;
480 pool->compact_wq = create_singlethread_workqueue(pool->name);
481 if (!pool->compact_wq)
482 goto out;
483 pool->release_wq = create_singlethread_workqueue(pool->name);
484 if (!pool->release_wq)
485 goto out_wq;
486 INIT_WORK(&pool->work, free_pages_work);
487 pool->ops = ops;
488 return pool;
489
490 out_wq:
491 destroy_workqueue(pool->compact_wq);
492 out:
> 493 free_percpu(pool->unbuddied);
494 kfree(pool);
495 return NULL;
496 }
497
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
prev parent reply other threads:[~2018-04-05 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 0:51 [PATCH 1/1] z3fold: fix memory leak Xidong Wang
2018-04-04 22:20 ` Andrew Morton
2018-04-04 22:23 ` Andrew Morton
2018-04-05 14:57 ` kbuild test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201804052205.ejzdZ5Qg%fengguang.wu@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@linux.vnet.ibm.com \
--cc=vitalywool@gmail.com \
--cc=wangxidong_97@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).