From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: kernel/trace/trace_events.c:2657 add_str_to_module() warn: possible memory leak of 'modstr'
Date: Thu, 9 Feb 2023 06:36:12 +0800 [thread overview]
Message-ID: <202302090643.sYPXqFRc-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: "Steven Rostedt (Google)" <rostedt@goodmis.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
commit: 795301d3c28996219d555023ac6863401b6076bc tracing: Have type enum modifications copy the strings
date: 11 months ago
:::::: branch date: 24 hours ago
:::::: commit date: 11 months ago
config: powerpc-randconfig-m041-20230208 (https://download.01.org/0day-ci/archive/20230209/202302090643.sYPXqFRc-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202302090643.sYPXqFRc-lkp@intel.com
smatch warnings:
kernel/trace/trace_events.c:2657 add_str_to_module() warn: possible memory leak of 'modstr'
vim +/modstr +2657 kernel/trace/trace_events.c
0c564a538aa934 Steven Rostedt (Red Hat 2015-03-24 2643)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2644) static void add_str_to_module(struct module *module, char *str)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2645) {
795301d3c28996 Steven Rostedt (Google 2022-03-18 2646) struct module_string *modstr;
795301d3c28996 Steven Rostedt (Google 2022-03-18 2647)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2648) modstr = kmalloc(sizeof(*modstr), GFP_KERNEL);
795301d3c28996 Steven Rostedt (Google 2022-03-18 2649)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2650) /*
795301d3c28996 Steven Rostedt (Google 2022-03-18 2651) * If we failed to allocate memory here, then we'll just
795301d3c28996 Steven Rostedt (Google 2022-03-18 2652) * let the str memory leak when the module is removed.
795301d3c28996 Steven Rostedt (Google 2022-03-18 2653) * If this fails to allocate, there's worse problems than
795301d3c28996 Steven Rostedt (Google 2022-03-18 2654) * a leaked string on module removal.
795301d3c28996 Steven Rostedt (Google 2022-03-18 2655) */
795301d3c28996 Steven Rostedt (Google 2022-03-18 2656) if (WARN_ON_ONCE(!modstr))
795301d3c28996 Steven Rostedt (Google 2022-03-18 @2657) return;
795301d3c28996 Steven Rostedt (Google 2022-03-18 2658)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2659) modstr->module = module;
795301d3c28996 Steven Rostedt (Google 2022-03-18 2660) modstr->str = str;
795301d3c28996 Steven Rostedt (Google 2022-03-18 2661)
795301d3c28996 Steven Rostedt (Google 2022-03-18 2662) list_add(&modstr->next, &module_strings);
795301d3c28996 Steven Rostedt (Google 2022-03-18 2663) }
795301d3c28996 Steven Rostedt (Google 2022-03-18 2664)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next reply other threads:[~2023-02-08 22:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 22:36 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-02-10 0:16 kernel/trace/trace_events.c:2657 add_str_to_module() warn: possible memory leak of 'modstr' kernel test robot
2023-02-09 7:09 kernel test robot
2023-02-08 11:35 kernel test robot
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=202302090643.sYPXqFRc-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.