[ogabbay:habanalabs-next 11/40] drivers/misc/habanalabs/common/state_dump.c:434:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]

From: kernel test robot
Date: Tue Jul 27 2021 - 20:41:42 EST



tree: https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git habanalabs-next
head: ed1ec0f6c655003eb3f092f47e98181646e88173
commit: 2b6cdda5981340a654d48826992fbb07c59f6c68 [11/40] habanalabs: expose state dump
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: x86_64-randconfig-c001-20210727 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c658b472f3e61e1818e1909bf02f3d65470018a5)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=2b6cdda5981340a654d48826992fbb07c59f6c68
git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
git fetch --no-tags ogabbay habanalabs-next
git checkout 2b6cdda5981340a654d48826992fbb07c59f6c68
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)
include/linux/rcupdate.h:390:2: note: expanded from macro '__rcu_dereference_check'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
^
include/linux/rcupdate.h:318:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
^
fs/ext4/resize.c:1232:13: note: Loop condition is false. Exiting loop
gdb_bh = sbi_array_rcu_deref(sbi, s_group_desc,
^
fs/ext4/ext4.h:1729:21: note: expanded from macro 'sbi_array_rcu_deref'
_v = ((typeof(_v)*)rcu_dereference((sbi)->field))[index]; \
^
include/linux/rcupdate.h:596:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:528:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:390:2: note: expanded from macro '__rcu_dereference_check'
RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
^
include/linux/rcupdate.h:316:2: note: expanded from macro 'RCU_LOCKDEP_WARN'
do { \
^
fs/ext4/resize.c:1234:4: note: Loop condition is false. Exiting loop
BUFFER_TRACE(gdb_bh, "get_write_access");
^
include/linux/jbd2.h:1835:32: note: expanded from macro 'BUFFER_TRACE'
#define BUFFER_TRACE(bh, info) do {} while (0)
^
fs/ext4/resize.c:1237:8: note: Assuming 'err' is 0
if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))
^~~~
fs/ext4/resize.c:1237:8: note: Left side of '&&' is true
fs/ext4/resize.c:1237:16: note: Assuming 'reserved_gdb' is not equal to 0
if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))
^~~~~~~~~~~~
fs/ext4/resize.c:1237:8: note: Left side of '&&' is true
if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))
^
fs/ext4/resize.c:1237:32: note: Assuming the condition is true
if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))

^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/resize.c:1237:4: note: Taking true branch
if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))
^
fs/ext4/resize.c:1238:38: note: Passing null pointer value via 2nd parameter 'inode'
err = reserve_backup_gdb(handle, resize_inode, group);

^~~~~~~~~~~~
fs/ext4/resize.c:1238:11: note: Calling 'reserve_backup_gdb'
err = reserve_backup_gdb(handle, resize_inode, group);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/resize.c:988:27: note: Access to field 'i_sb' results in a dereference of a null pointer (loaded from variable 'inode')
struct super_block *sb = inode->i_sb;
^~~~~
fs/ext4/resize.c:1921:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = ret;
^ ~~~
fs/ext4/resize.c:1921:3: note: Value stored to 'err' is never read
err = ret;
^ ~~~
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.
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.
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.
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.
9 warnings generated.
drivers/misc/habanalabs/common/firmware_if.c:1231:2: warning: Value stored to 'cpu_boot_dev_sts1' is never read [clang-analyzer-deadcode.DeadStores]
cpu_boot_dev_sts1 = prop->fw_preboot_cpu_boot_dev_sts1;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/firmware_if.c:1231:2: note: Value stored to 'cpu_boot_dev_sts1' is never read
cpu_boot_dev_sts1 = prop->fw_preboot_cpu_boot_dev_sts1;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/firmware_if.c:1516:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
rc = hl_fw_dynamic_send_clear_cmd(hdev, fw_loader);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/firmware_if.c:1516:2: note: Value stored to 'rc' is never read
rc = hl_fw_dynamic_send_clear_cmd(hdev, fw_loader);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
8 warnings generated.
drivers/misc/habanalabs/common/state_dump.c:434:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
rc = hl_snprintf_resize(&buf, &size, &offset,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/state_dump.c:434:2: note: Value stored to 'rc' is never read
rc = hl_snprintf_resize(&buf, &size, &offset,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
drivers/hid/hid-kye.c:684:6: warning: Access to field 'maxfield' results in a dereference of an undefined pointer value (loaded from variable 'report') [clang-analyzer-core.NullDereference]
if (report->maxfield < 1 || report->field[0]->report_count < 7) {
^
drivers/hid/hid-kye.c:708:6: note: Assuming 'ret' is 0
if (ret) {
^~~
drivers/hid/hid-kye.c:708:2: note: Taking false branch
if (ret) {
^
drivers/hid/hid-kye.c:714:6: note: Assuming 'ret' is 0
if (ret) {
^~~
drivers/hid/hid-kye.c:714:2: note: Taking false branch
if (ret) {
^
drivers/hid/hid-kye.c:719:2: note: Control jumps to 'case 20501:' at line 725
switch (id->product) {
^
drivers/hid/hid-kye.c:726:9: note: Calling 'kye_tablet_enable'
ret = kye_tablet_enable(hdev);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-kye.c:669:2: note: 'report' declared without an initial value
struct hid_report *report;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-kye.c:673:2: note: Loop condition is false. Execution continues on line 679
list_for_each(head, list) {
^
include/linux/list.h:571:2: note: expanded from macro 'list_for_each'
for (pos = (head)->next; pos != (head); pos = pos->next)
^
drivers/hid/hid-kye.c:679:6: note: Assuming 'head' is not equal to 'list'
if (head == list) {
^~~~~~~~~~~~
drivers/hid/hid-kye.c:679:2: note: Taking false branch
if (head == list) {
^
drivers/hid/hid-kye.c:684:6: note: Access to field 'maxfield' results in a dereference of an undefined pointer value (loaded from variable 'report')
if (report->maxfield < 1 || report->field[0]->report_count < 7) {
^~~~~~
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.
include/linux/hid.h:1007:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference]
input->name, c, type);
^
drivers/hid/hid-lcpower.c:24:6: note: Assuming the condition is false
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-lcpower.c:24:2: note: Taking false branch
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
^
drivers/hid/hid-lcpower.c:27:2: note: Control jumps to 'case 73:' at line 30
switch (usage->hid & HID_USAGE) {
^
drivers/hid/hid-lcpower.c:30:21: note: Calling 'hid_map_usage_clear'
case 0x049: ts_map_key_clear(KEY_BLUE); break;
^
drivers/hid/hid-lcpower.c:18:29: note: expanded from macro 'ts_map_key_clear'
#define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1035:2: note: Calling 'hid_map_usage'
hid_map_usage(hidinput, usage, bit, max, type, c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:982:2: note: 'input' initialized here
struct input_dev *input = hidinput->input;
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:986:2: note: Control jumps to 'case 1:' at line 995
switch (type) {
^
include/linux/hid.h:998:3: note: Execution continues on line 1005
break;
^
include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
include/linux/hid.h:1005:15: note: Left side of '||' is false
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:1005:28: note: Assuming 'bmap' is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \

vim +/rc +434 drivers/misc/habanalabs/common/state_dump.c

2b6cdda5981340 Yuri Nudelman 2021-06-06 423 2b6cdda5981340 Yuri Nudelman 2021-06-06 424 /**
2b6cdda5981340 Yuri Nudelman 2021-06-06 425 * hl_state_dump() - dump system state
2b6cdda5981340 Yuri Nudelman 2021-06-06 426 * @hdev: pointer to device structure
2b6cdda5981340 Yuri Nudelman 2021-06-06 427 */
2b6cdda5981340 Yuri Nudelman 2021-06-06 428 int hl_state_dump(struct hl_device *hdev)
2b6cdda5981340 Yuri Nudelman 2021-06-06 429 {
2b6cdda5981340 Yuri Nudelman 2021-06-06 430 char *buf = NULL;
2b6cdda5981340 Yuri Nudelman 2021-06-06 431 size_t offset = 0, size = 0;
2b6cdda5981340 Yuri Nudelman 2021-06-06 432 int rc;
2b6cdda5981340 Yuri Nudelman 2021-06-06 433 2b6cdda5981340 Yuri Nudelman 2021-06-06 @434 rc = hl_snprintf_resize(&buf, &size, &offset,

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx