From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Rob Herring <robh@kernel.org>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: drivers/of/dynamic.c:935 of_changeset_action() warn: possible memory leak of 'ce'
Date: Thu, 7 Sep 2023 13:52:48 +0300 [thread overview]
Message-ID: <eaa86211-436d-445b-80bd-84cea5745b5a@kadam.mountain> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 99d99825fc075fd24b60cc9cf0fb1e20b9c16b0f
commit: 914d9d831e6126a6e7a92e27fcfaa250671be42c of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock
config: x86_64-randconfig-161-20230831 (https://download.01.org/0day-ci/archive/20230901/202309011059.EOdr4im9-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230901/202309011059.EOdr4im9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202309011059.EOdr4im9-lkp@intel.com/
smatch warnings:
drivers/of/dynamic.c:935 of_changeset_action() warn: possible memory leak of 'ce'
vim +/ce +935 drivers/of/dynamic.c
201c910bd6898d Pantelis Antoniou 2014-07-04 925 int of_changeset_action(struct of_changeset *ocs, unsigned long action,
201c910bd6898d Pantelis Antoniou 2014-07-04 926 struct device_node *np, struct property *prop)
201c910bd6898d Pantelis Antoniou 2014-07-04 927 {
201c910bd6898d Pantelis Antoniou 2014-07-04 928 struct of_changeset_entry *ce;
201c910bd6898d Pantelis Antoniou 2014-07-04 929
201c910bd6898d Pantelis Antoniou 2014-07-04 930 ce = kzalloc(sizeof(*ce), GFP_KERNEL);
606ad42aa3b1fe Rob Herring 2016-06-15 931 if (!ce)
201c910bd6898d Pantelis Antoniou 2014-07-04 932 return -ENOMEM;
606ad42aa3b1fe Rob Herring 2016-06-15 933
914d9d831e6126 Rob Herring 2023-08-18 934 if (WARN_ON(action >= ARRAY_SIZE(action_names)))
914d9d831e6126 Rob Herring 2023-08-18 @935 return -EINVAL;
No kfree(ce). Probably we move this check before the kmalloc()?
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-09-07 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 10:52 Dan Carpenter [this message]
2023-09-07 11:30 ` Geert Uytterhoeven
2023-09-07 11:47 ` Dan Carpenter
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=eaa86211-436d-445b-80bd-84cea5745b5a@kadam.mountain \
--to=dan.carpenter@linaro.org \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®