Re: [PATCH v6] Bluetooth: btrtl: Add firmware format v3 support
Dan Carpenter <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild |
|---|---|
| Message-ID | <20260822081024._fBIZ_6xB6EhAnUp6hzhDfpqIVwvN0O9f6YQlylk7CQ@z> |
Hi Hilda, kernel test robot noticed the following build warnings: https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Hilda-Wu/Bluetooth-btrtl-Add-firmware-format-v3-support/20260814-145920 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master patch link: https://lore.kernel.org/r/20260814065920.413487-1-hildawu%40realtek.com patch subject: [PATCH v6] Bluetooth: btrtl: Add firmware format v3 support config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260822/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 smatch: v0.5.0-9187-g5189e3fb 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]/ New smatch warnings: drivers/bluetooth/btrtl.c:1106 btrtl_free() warn: variable dereferenced before check 'btrtl_dev' (see line 1098) Old smatch warnings: drivers/bluetooth/btrtl.c:1326 btrtl_initialize() warn: passing zero to 'ERR_PTR' vim +/btrtl_dev +1106 drivers/bluetooth/btrtl.c 26503ad25de8c7c Martin Blumenstingl 2018-08-02 1094 void btrtl_free(struct btrtl_device_info *btrtl_dev) 26503ad25de8c7c Martin Blumenstingl 2018-08-02 1095 { 9a24ce5e29b15c4 Max Chou 2023-04-17 1096 struct rtl_subsection *entry, *tmp; 9a24ce5e29b15c4 Max Chou 2023-04-17 1097 268d3636dfb2225 Alice Mikityanska 2020-01-24 @1098 kvfree(btrtl_dev->fw_data); 268d3636dfb2225 Alice Mikityanska 2020-01-24 1099 kvfree(btrtl_dev->cfg_data); 9a24ce5e29b15c4 Max Chou 2023-04-17 1100 9a24ce5e29b15c4 Max Chou 2023-04-17 1101 list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) { 9a24ce5e29b15c4 Max Chou 2023-04-17 1102 list_del(&entry->list); 9a24ce5e29b15c4 Max Chou 2023-04-17 1103 kfree(entry); 9a24ce5e29b15c4 Max Chou 2023-04-17 1104 } 9a24ce5e29b15c4 Max Chou 2023-04-17 1105 8e4d5e1dbe2345c Hilda Wu 2026-08-14 @1106 if (btrtl_dev) { No point in checking for NULL when we have already dereferenced btrtl_dev so many times. 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1107 struct btrtl_enh_ops *ops = symbol_get(rtl_enh_ops); 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1108 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1109 if (ops) { 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1110 if (ops->free_patch_images) 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1111 ops->free_patch_images(btrtl_dev); 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1112 symbol_put(rtl_enh_ops); 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1113 } 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1114 } 8e4d5e1dbe2345c Hilda Wu 2026-08-14 1115 26503ad25de8c7c Martin Blumenstingl 2018-08-02 1116 kfree(btrtl_dev); 26503ad25de8c7c Martin Blumenstingl 2018-08-02 1117 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki