All of lore.kernel.org
 help / color / mirror / Atom feed
* [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]
@ 2021-07-29  7:05 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-07-29  7:05 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15990 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Yuri Nudelman <ynudelman@habana.ai>
CC: Oded Gabbay <ogabbay@kernel.org>

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: 2 days ago
:::::: commit date: 2 days 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@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                     ^
   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: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   include/linux/hid.h:1005:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:1005:29: note: 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                      ^
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   include/linux/hid.h:1005:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:1006:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:540:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1006:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:540:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:1007:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);
                                       ^
   include/linux/printk.h:557:49: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:541:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   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.
   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.
   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.
   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.
   9 warnings generated.
   drivers/w1/slaves/w1_therm.c:159:8: warning: Excessive padding in 'struct w1_therm_family_converter' (12 padding bytes, where 4 is optimal). 
   Optimal fields order: 
   f, 
   convert, 
   get_conversion_time, 
   set_resolution, 
   get_resolution, 
   write_data, 
   reserved, 
   broken, 
   bulk_read, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct w1_therm_family_converter {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:159:8: note: Excessive padding in 'struct w1_therm_family_converter' (12 padding bytes, where 4 is optimal). Optimal fields order: f, convert, get_conversion_time, set_resolution, get_resolution, write_data, reserved, broken, bulk_read, consider reordering the fields or adding explicit padding members
   struct w1_therm_family_converter {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:1252:5: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                                   ret = -EIO;
                                   ^     ~~~~
   drivers/w1/slaves/w1_therm.c:1252:5: note: Value stored to 'ret' is never read
                                   ret = -EIO;
                                   ^     ~~~~
   drivers/w1/slaves/w1_therm.c:1799:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(p_args, buf);
           ^~~~~~
   drivers/w1/slaves/w1_therm.c:1799:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(p_args, buf);
           ^~~~~~
   drivers/w1/slaves/w1_therm.c:2090:22: warning: The right operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (sl->reg_num.id == reg_num->id)
                                      ^  ~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2067:6: note: Assuming the condition is false
           if (w1_reset_bus(sl->master))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2067:2: note: Taking false branch
           if (w1_reset_bus(sl->master))
           ^
   drivers/w1/slaves/w1_therm.c:2077:6: note: Assuming 'ack' is equal to W1_42_SUCCESS_CONFIRM_BYTE
           if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2077:2: note: Taking false branch
           if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
           ^
   drivers/w1/slaves/w1_therm.c:2081:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i <= 64; i++) {
           ^
   drivers/w1/slaves/w1_therm.c:2082:7: note: Assuming the condition is false
                   if (w1_reset_bus(sl->master))
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2082:3: note: Taking false branch
                   if (w1_reset_bus(sl->master))
                   ^
   drivers/w1/slaves/w1_therm.c:2088:7: note: Assuming field 'family' is not equal to W1_42_FINISHED_BYTE
                   if (reg_num->family == W1_42_FINISHED_BYTE)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2088:3: note: Taking false branch
                   if (reg_num->family == W1_42_FINISHED_BYTE)
                   ^
   drivers/w1/slaves/w1_therm.c:2090:22: note: The right operand of '==' is a garbage value
                   if (sl->reg_num.id == reg_num->id)
                                      ^  ~~~~~~~~~~~
   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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   63 warnings generated.
   drivers/net/fddi/skfp/pmf.c:63:21: warning: Excessive padding in 'struct s_p_tab' (2 padding bytes, where 0 is optimal). 
   Optimal fields order: 
   p_num, 
   p_offset, 
   p_access, 
   p_swap, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   static const struct s_p_tab {
                ~~~~~~~^~~~~~~~~
   drivers/net/fddi/skfp/pmf.c:63:21: note: Excessive padding in 'struct s_p_tab' (2 padding bytes, where 0 is optimal). Optimal fields order: p_num, p_offset, p_access, p_swap, consider reordering the fields or adding explicit padding members
   static const struct s_p_tab {
                ~~~~~~~^~~~~~~~~

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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34139 bytes --]

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

* [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]
  2021-07-27 23:26 kernel test robot
@ 2021-07-28  0:41   ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-07-28  0:41 UTC (permalink / raw)
  To: Yuri Nudelman; +Cc: clang-built-linux, kbuild-all, LKML, Oded Gabbay

[-- Attachment #1: Type: text/plain, Size: 14821 bytes --]


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@intel.com>


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@lists.01.org


[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34138 bytes --]

[-- Attachment #3: Attached Message Part --]
[-- Type: text/plain, Size: 150 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


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

* [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]
@ 2021-07-28  0:41   ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-07-28  0:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 15144 bytes --]


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@intel.com>


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(a)lists.01.org


[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34138 bytes --]

[-- Attachment #3: AttachedMessagePart.ksh --]
[-- Type: text/plain, Size: 150 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


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

* [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]
@ 2021-07-27 23:26 kernel test robot
  2021-07-28  0:41   ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2021-07-27 23:26 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15226 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Yuri Nudelman <ynudelman@habana.ai>
CC: Oded Gabbay <ogabbay@kernel.org>

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@intel.com>


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:' @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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34138 bytes --]

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

end of thread, other threads:[~2021-07-29  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  7:05 [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] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-07-27 23:26 kernel test robot
2021-07-28  0:41 ` kernel test robot
2021-07-28  0:41   ` 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.