All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
@ 2021-12-05  5:48 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-12-05  5:48 UTC (permalink / raw)
  To: kbuild

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
@ 2021-12-06  2:24 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-12-06  2:24 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 14210 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:   0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1
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/20211206/202112061034.5t3y7U95-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 >>)
               ^~~~~~~~~~~~
   drivers/base/bus.c:44:6: note: 'bus' is non-null
           if (bus) {
               ^~~
   drivers/base/bus.c:44:2: note: Taking true branch
           if (bus) {
           ^
   drivers/base/bus.c:46:3: note: Returning without writing to 'bus->p'
                   return bus;
                   ^
   drivers/base/bus.c:145:6: note: Returning from 'bus_get'
           if (bus_get(bus)) {
               ^~~~~~~~~~~~
   drivers/base/bus.c:145:2: note: Taking true branch
           if (bus_get(bus)) {
           ^
   drivers/base/bus.c:147:3: note: Calling 'bus_put'
                   bus_put(bus);
                   ^~~~~~~~~~~~
   drivers/base/bus.c:53:6: note: 'bus' is non-null
           if (bus)
               ^~~
   drivers/base/bus.c:53:2: note: Taking true branch
           if (bus)
           ^
   drivers/base/bus.c:55:1: note: Returning without writing to 'bus->p'
   }
   ^
   drivers/base/bus.c:147:3: note: Returning from 'bus_put'
                   bus_put(bus);
                   ^~~~~~~~~~~~
   drivers/base/bus.c:149:1: note: Returning without writing to '->p'
   }
   ^
   drivers/base/bus.c:572:2: note: Returning from 'bus_remove_file'
           bus_remove_file(bus, &bus_attr_drivers_autoprobe);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/bus.c:573:2: note: Calling 'bus_remove_file'
           bus_remove_file(bus, &bus_attr_drivers_probe);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/bus.c:145:6: note: Calling 'bus_get'
           if (bus_get(bus)) {
               ^~~~~~~~~~~~
   drivers/base/bus.c:44:6: note: 'bus' is non-null
           if (bus) {
               ^~~
   drivers/base/bus.c:44:2: note: Taking true branch
           if (bus) {
           ^
   drivers/base/bus.c:46:3: note: Returning without writing to 'bus->p'
                   return bus;
                   ^
   drivers/base/bus.c:145:6: note: Returning from 'bus_get'
           if (bus_get(bus)) {
               ^~~~~~~~~~~~
   drivers/base/bus.c:145:2: note: Taking true branch
           if (bus_get(bus)) {
           ^
   drivers/base/bus.c:147:3: note: Calling 'bus_put'
                   bus_put(bus);
                   ^~~~~~~~~~~~
   drivers/base/bus.c:53:6: note: 'bus' is non-null
           if (bus)
               ^~~
   drivers/base/bus.c:53:2: note: Taking true branch
           if (bus)
           ^
   drivers/base/bus.c:55:1: note: Returning without writing to 'bus->p'
   }
   ^
   drivers/base/bus.c:147:3: note: Returning from 'bus_put'
                   bus_put(bus);
                   ^~~~~~~~~~~~
   drivers/base/bus.c:149:1: note: Returning without writing to '->p'
   }
   ^
   drivers/base/bus.c:573:2: note: Returning from 'bus_remove_file'
           bus_remove_file(bus, &bus_attr_drivers_probe);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/bus.c:574:1: note: Returning without writing to 'bus->p'
   }
   ^
   drivers/base/bus.c:872:2: note: Returning from 'remove_probe_files'
           remove_probe_files(bus);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/bus.c:873:18: note: Access to field 'drivers_kset' results in a dereference of a null pointer (loaded from field 'p')
           kset_unregister(bus->p->drivers_kset);
                           ^    ~
   Suppressed 5 warnings (5 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.
   14 warnings generated.
   Suppressed 14 warnings (14 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-06  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05  5:48 drivers/platform/chrome/chromeos_laptop.c:861:25: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc] kernel test robot
2021-12-06  2:24 kernel test robot

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.