Skip to contentSkip to conversation

drivers/thermal/testing/zone.c:189 tt_add_tz() error: uninitialized symbol 'tt_work'.

PATCH New Dan Carpenter 1 participant 1 message Aug 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 5654/6069 drivers/thermal/testing/zone.c:189 tt_add_tz() error: uninitialized symbol 'tt_work'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6a7917c89f219f09b1d88d09f376000914a52763
commit: 707bc0f91a35b7bd0c139e0bf49b2b3d32a6d207 [5654/6069] thermal: Introduce a debugfs-based testing facility
config: i386-randconfig-141-20240822 (https://download.01.org/0day-ci/archive/20240823/[email protected]/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/thermal/testing/zone.c:189 tt_add_tz() error: uninitialized symbol 'tt_work'. drivers/thermal/testing/zone.c:241 tt_del_tz() error: uninitialized symbol 'tt_work'. drivers/thermal/testing/zone.c:337 tt_zone_add_trip() error: uninitialized symbol 'tt_trip'. drivers/thermal/testing/zone.c:395 tt_zone_register_tz() error: uninitialized symbol 'trips'.

vim +/tt_work +189 drivers/thermal/testing/zone.c

707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  186  int tt_add_tz(void)
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  187  {
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  188  	struct tt_thermal_zone *tt_zone __free(kfree);
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02 @189  	struct tt_work *tt_work __free(kfree);

These need to be initialized to NULL

707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  190  	int ret;
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  191  
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  192  	tt_zone = kzalloc(sizeof(*tt_zone), GFP_KERNEL);
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  193  	if (!tt_zone)
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  194  		return -ENOMEM;

Otherwise tt_work is uninitialized on this error path. The other warnings are the same thing.

707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  195  
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  196  	tt_work = kzalloc(sizeof(*tt_work), GFP_KERNEL);
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  197  	if (!tt_work)
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  198  		return -ENOMEM;
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  199  
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  200  	INIT_LIST_HEAD(&tt_zone->trips);
707bc0f91a35b7 Rafael J. Wysocki 2024-08-02  201  	mutex_init(&tt_zone->lock);
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki