From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
Date: Sun, 05 Dec 2021 13:48:16 +0800 [thread overview]
Message-ID: <202112051300.QbMVIO9i-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 17054 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Nick Desaulniers <ndesaulniers@google.com>
CC: Masahiro Yamada <masahiroy@kernel.org>
CC: Nathan Chancellor <nathan@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 79a72162048e42a677bc7336a9f5d86fc3ff9558
commit: f12b034afeb3a977bbb1c6584dedc0f3dc666f14 scripts/Makefile.clang: default to LLVM_IAS=1
date: 4 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 4 months ago
config: i386-randconfig-c001-20211128 (https://download.01.org/0day-ci/archive/20211205/202112051300.QbMVIO9i-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5162b558d8c0b542e752b037e72a69d5fd51eb1e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f12b034afeb3a977bbb1c6584dedc0f3dc666f14
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f12b034afeb3a977bbb1c6584dedc0f3dc666f14
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (6 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (6 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
>> drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
i2c_unregister_device(i2c_dev->client);
^
drivers/platform/chrome/chromeos_laptop.c:953:13: note: Calling 'chromeos_laptop_init'
module_init(chromeos_laptop_init);
^
include/linux/module.h:88:35: note: expanded from macro 'module_init'
#define module_init(x) __initcall(x);
~~~~~~~~~~~^~
include/linux/init.h:296:40: note: expanded from macro '__initcall'
#define __initcall(fn) device_initcall(fn)
~~~~~~~~~~~~~~~~^~~
include/linux/init.h:291:48: note: expanded from macro 'device_initcall'
#define device_initcall(fn) __define_initcall(fn, 6)
~~~~~~~~~~~~~~~~~~^~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/init.h:254:22: note: expanded from macro '__unique_initcall'
____define_initcall(fn, \
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/init.h:241:33: note: expanded from macro '____define_initcall'
__define_initcall_stub(__stub, fn) \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
include/linux/init.h:226:10: note: expanded from macro '__define_initcall_stub'
return fn(); \
^~~~
drivers/platform/chrome/chromeos_laptop.c:907:6: note: Assuming 'dmi_id' is non-null
if (!dmi_id) {
^~~~~~~
drivers/platform/chrome/chromeos_laptop.c:907:2: note: Taking false branch
if (!dmi_id) {
^
drivers/platform/chrome/chromeos_laptop.c:912:2: note: Taking false branch
pr_debug("DMI Matched %s\n", dmi_id->ident);
^
include/linux/printk.h:471:2: note: expanded from macro 'pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
include/linux/dynamic_debug.h:162:2: note: expanded from macro 'dynamic_pr_debug'
_dynamic_func_call(fmt, __dynamic_pr_debug, \
^
include/linux/dynamic_debug.h:152:2: note: expanded from macro '_dynamic_func_call'
__dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
^
include/linux/dynamic_debug.h:133:2: note: expanded from macro '__dynamic_func_call'
if (DYNAMIC_DEBUG_BRANCH(id)) \
^
drivers/platform/chrome/chromeos_laptop.c:912:2: note: Loop condition is false. Exiting loop
pr_debug("DMI Matched %s\n", dmi_id->ident);
^
include/linux/printk.h:471:2: note: expanded from macro 'pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
include/linux/dynamic_debug.h:162:2: note: expanded from macro 'dynamic_pr_debug'
_dynamic_func_call(fmt, __dynamic_pr_debug, \
^
include/linux/dynamic_debug.h:152:2: note: expanded from macro '_dynamic_func_call'
__dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
^
include/linux/dynamic_debug.h:131:49: note: expanded from macro '__dynamic_func_call'
#define __dynamic_func_call(id, fmt, func, ...) do { \
^
drivers/platform/chrome/chromeos_laptop.c:914:16: note: Calling 'chromeos_laptop_prepare'
cros_laptop = chromeos_laptop_prepare((void *)dmi_id->driver_data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:885:6: note: Assuming 'cros_laptop' is non-null
if (!cros_laptop)
^~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:885:2: note: Taking false branch
if (!cros_laptop)
^
drivers/platform/chrome/chromeos_laptop.c:888:10: note: Calling 'chromeos_laptop_prepare_i2c_peripherals'
error = chromeos_laptop_prepare_i2c_peripherals(cros_laptop, src);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:748:6: note: Assuming field 'num_i2c_peripherals' is not equal to 0
if (!src->num_i2c_peripherals)
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:748:2: note: Taking false branch
if (!src->num_i2c_peripherals)
^
drivers/platform/chrome/chromeos_laptop.c:755:6: note: Assuming field 'i2c_peripherals' is non-null
if (!cros_laptop->i2c_peripherals)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:755:2: note: Taking false branch
if (!cros_laptop->i2c_peripherals)
^
drivers/platform/chrome/chromeos_laptop.c:760:14: note: 'i' is < field 'num_i2c_peripherals'
for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) {
^
drivers/platform/chrome/chromeos_laptop.c:760:2: note: Loop condition is true. Entering loop body
for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) {
^
drivers/platform/chrome/chromeos_laptop.c:765:7: note: 'error' is 0
if (error)
^~~~~
drivers/platform/chrome/chromeos_laptop.c:765:3: note: Taking false branch
if (error)
^
drivers/platform/chrome/chromeos_laptop.c:769:7: note: Assuming field 'properties' is non-null
if (i2c_dev->properties) {
^~~~~~~~~~~~~~~~~~~
drivers/platform/chrome/chromeos_laptop.c:769:3: note: Taking true branch
vim +861 drivers/platform/chrome/chromeos_laptop.c
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 852
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 853 static void chromeos_laptop_destroy(const struct chromeos_laptop *cros_laptop)
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 854 {
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 855 const struct acpi_peripheral *acpi_dev;
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 856 struct i2c_peripheral *i2c_dev;
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 857 int i;
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 858
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 859 for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) {
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 860 i2c_dev = &cros_laptop->i2c_peripherals[i];
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 @861 i2c_unregister_device(i2c_dev->client);
65582920d72d25 Dmitry Torokhov 2018-03-20 862 }
65582920d72d25 Dmitry Torokhov 2018-03-20 863
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 864 for (i = 0; i < cros_laptop->num_acpi_peripherals; i++) {
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 865 acpi_dev = &cros_laptop->acpi_peripherals[i];
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 866
2c02f659851a96 Heikki Krogerus 2021-03-29 867 if (acpi_dev->client)
2c02f659851a96 Heikki Krogerus 2021-03-29 868 device_remove_software_node(&acpi_dev->client->dev);
2c02f659851a96 Heikki Krogerus 2021-03-29 869
2c02f659851a96 Heikki Krogerus 2021-03-29 870 property_entries_free(acpi_dev->swnode.properties);
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 871 }
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 872
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 873 kfree(cros_laptop->i2c_peripherals);
5020cd29d8bfcb Dmitry Torokhov 2018-05-03 874 kfree(cros_laptop->acpi_peripherals);
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 875 kfree(cros_laptop);
c0bb0608ec79f8 Dmitry Torokhov 2018-03-20 876 }
65582920d72d25 Dmitry Torokhov 2018-03-20 877
:::::: The code at line 861 was first introduced by commit
:::::: c0bb0608ec79f8480432e169ccc3857dc7f7c205 platform/chrome: chromeos_laptop - discard data for unneeded boards
:::::: TO: Dmitry Torokhov <dmitry.torokhov@gmail.com>
:::::: CC: Benson Leung <bleung@chromium.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2021-12-05 5:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-05 5:48 kernel test robot [this message]
2021-12-06 2:24 drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc] 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=202112051300.QbMVIO9i-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 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.