LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [rmk-arm:zii 80/94] drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false
@ 2021-10-28  6:11 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-10-28  6:11 UTC (permalink / raw)
  To: Russell King; +Cc: llvm, kbuild-all, linux-kernel

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

tree:   git://git.armlinux.org.uk/~rmk/linux-arm zii
head:   63399fbad78b99ef5619e4e62852e196a08ea23d
commit: 148b1cb5788a164699680d379ce9e93c7c4b3734 [80/94] net: dsa: mv88e6xxx: convert 88e6352 to phylink_pcs *EXPERIMENTAL*
config: arm-randconfig-c002-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        git remote add rmk-arm git://git.armlinux.org.uk/~rmk/linux-arm
        git fetch --no-tags rmk-arm zii
        git checkout 148b1cb5788a164699680d379ce9e93c7c4b3734
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (oldpage >= 0)
               ^~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:53: note: uninitialized use occurs here
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                                                              ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:2: note: remove the 'if' if its condition is always true
           if (oldpage >= 0)
           ^~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:113:18: note: initialize the variable 'err' to silence this warning
           int oldpage, err;
                           ^
                            = 0
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (oldpage >= 0)
               ^~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:53: note: uninitialized use occurs here
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                                                              ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:2: note: remove the 'if' if its condition is always true
           if (oldpage >= 0)
           ^~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:182:23: note: initialize the variable 'err' to silence this warning
           int oldpage, adv, err;
                                ^
                                 = 0
   2 warnings generated.


clang-analyzer warnings: (new ones prefixed by >>)
                   list = list_first_entry(&qgroup->groups,
                          ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   fs/btrfs/qgroup.c:232:10: note: Loop condition is false.  Exiting loop
                   list = list_first_entry(&qgroup->groups,
                          ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   fs/btrfs/qgroup.c:234:3: note: Calling 'list_del'
                   list_del(&list->next_group);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:147:14: note: Use of memory after it is freed
           entry->next = LIST_POISON1;
           ~~~~~~~~~~~ ^
   Suppressed 1 warnings (1 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.
   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.
   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.
   8 warnings generated.
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:9: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:200:2: note: Calling 'marvell_c22_pcs_modify'
           marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_ANRESTART, BMCR_ANRESTART);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:113:15: note: 'err' declared without an initial value
           int oldpage, err;
                        ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: note: 'oldpage' is < 0
           if (oldpage >= 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:2: note: Taking false branch
           if (oldpage >= 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:9: note: 3rd function call argument is an uninitialized value
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:9: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:182:20: note: 'err' declared without an initial value
           int oldpage, adv, err;
                             ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:185:6: note: Assuming 'adv' is >= 0
           if (adv < 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:185:2: note: Taking false branch
           if (adv < 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:6: note: 'oldpage' is < 0
           if (oldpage >= 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:2: note: Taking false branch
           if (oldpage >= 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:9: note: 3rd function call argument is an uninitialized value
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
>> drivers/net/dsa/mv88e6xxx/serdes-6352.c:228:8: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
                   bmcr |= BMCR_FULLDPLX;
                   ~~~~ ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:209:2: note: 'bmcr' declared without an initial value
           u16 bmcr;
           ^~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Calling 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:9: note: Assuming 'mode' is not equal to MLO_AN_INBAND
           return mode == MLO_AN_INBAND;
                  ^~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:2: note: Returning zero, which participates in a condition later
           return mode == MLO_AN_INBAND;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Returning from 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:2: note: Taking false branch
           if (phylink_autoneg_inband(mode))
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:215:2: note: 'Default' branch taken. Execution continues on line 227
           switch (speed) {
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:6: note: Assuming 'duplex' is equal to DUPLEX_FULL
           if (duplex == DUPLEX_FULL)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:2: note: Taking true branch
           if (duplex == DUPLEX_FULL)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:228:8: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
                   bmcr |= BMCR_FULLDPLX;
                   ~~~~ ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:230:8: warning: 4th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_SPEED100 |
                 ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:209:2: note: 'bmcr' declared without an initial value
           u16 bmcr;
           ^~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Calling 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:9: note: Assuming 'mode' is not equal to MLO_AN_INBAND
           return mode == MLO_AN_INBAND;
                  ^~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:2: note: Returning zero, which participates in a condition later
           return mode == MLO_AN_INBAND;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Returning from 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:2: note: Taking false branch
           if (phylink_autoneg_inband(mode))
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:215:2: note: 'Default' branch taken. Execution continues on line 227
           switch (speed) {
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:6: note: Assuming 'duplex' is not equal to DUPLEX_FULL
           if (duplex == DUPLEX_FULL)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:2: note: Taking false branch
           if (duplex == DUPLEX_FULL)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:230:8: note: 4th function call argument is an uninitialized value
           err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_SPEED100 |
                 ^
   Suppressed 4 warnings (2 in non-user code, 2 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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   drivers/dma/sf-pdma/sf-pdma.c:59:6: warning: Access to field 'desc' results in a dereference of a null pointer (loaded from variable 'chan') [clang-analyzer-core.NullDereference]
           if (chan->desc && !chan->desc->in_use) {
               ^
   drivers/dma/sf-pdma/sf-pdma.c:95:30: note: Calling 'to_sf_pdma_chan'
           struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
                                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Left side of '&&' is false
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
                  ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Taking false branch
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
                  ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
--
   1 warning generated.
   Suppressed 1 warnings (1 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.
   net/vmw_vsock/af_vsock.c:917:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:917:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1131:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1131:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1303:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1303:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1675:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1675:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1732:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:1732:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:2075:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   net/vmw_vsock/af_vsock.c:2075:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   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.
   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.
   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.
   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.
   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.
   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.
   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.
   8 warnings generated.
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:9: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:200:2: note: Calling 'marvell_c22_pcs_modify'
           marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_ANRESTART, BMCR_ANRESTART);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:113:15: note: 'err' declared without an initial value
           int oldpage, err;
                        ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: note: 'oldpage' is < 0
           if (oldpage >= 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:2: note: Taking false branch
           if (oldpage >= 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:9: note: 3rd function call argument is an uninitialized value
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:9: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:182:20: note: 'err' declared without an initial value
           int oldpage, adv, err;
                             ^~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:185:6: note: Assuming 'adv' is >= 0
           if (adv < 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:185:2: note: Taking false branch
           if (adv < 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:6: note: 'oldpage' is < 0
           if (oldpage >= 0)
               ^~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:2: note: Taking false branch
           if (oldpage >= 0)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:9: note: 3rd function call argument is an uninitialized value
           return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
                  ^                                           ~~~
>> drivers/net/dsa/mv88e6xxx/serdes-6352.c:228:8: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
                   bmcr |= BMCR_FULLDPLX;
                   ~~~~ ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:209:2: note: 'bmcr' declared without an initial value
           u16 bmcr;
           ^~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Calling 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:9: note: Assuming 'mode' is not equal to MLO_AN_INBAND
           return mode == MLO_AN_INBAND;
                  ^~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:2: note: Returning zero, which participates in a condition later
           return mode == MLO_AN_INBAND;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Returning from 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:2: note: Taking false branch
           if (phylink_autoneg_inband(mode))
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:215:2: note: 'Default' branch taken. Execution continues on line 227
           switch (speed) {
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:6: note: Assuming 'duplex' is equal to DUPLEX_FULL
           if (duplex == DUPLEX_FULL)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:2: note: Taking true branch
           if (duplex == DUPLEX_FULL)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:228:8: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
                   bmcr |= BMCR_FULLDPLX;
                   ~~~~ ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:230:8: warning: 4th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_SPEED100 |
                 ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:209:2: note: 'bmcr' declared without an initial value
           u16 bmcr;
           ^~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Calling 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:9: note: Assuming 'mode' is not equal to MLO_AN_INBAND
           return mode == MLO_AN_INBAND;
                  ^~~~~~~~~~~~~~~~~~~~~
   include/linux/phylink.h:27:2: note: Returning zero, which participates in a condition later
           return mode == MLO_AN_INBAND;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:6: note: Returning from 'phylink_autoneg_inband'
           if (phylink_autoneg_inband(mode))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:212:2: note: Taking false branch
           if (phylink_autoneg_inband(mode))
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:215:2: note: 'Default' branch taken. Execution continues on line 227
           switch (speed) {
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:6: note: Assuming 'duplex' is not equal to DUPLEX_FULL
           if (duplex == DUPLEX_FULL)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:227:2: note: Taking false branch
           if (duplex == DUPLEX_FULL)
           ^
   drivers/net/dsa/mv88e6xxx/serdes-6352.c:230:8: note: 4th function call argument is an uninitialized value
           err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_SPEED100 |
                 ^
   Suppressed 4 warnings (2 in non-user code, 2 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.
   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.
   10 warnings generated.
   net/key/af_key.c:1166:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = -ENOBUFS;
           ^     ~~~~~~~~
   net/key/af_key.c:1166:2: note: Value stored to 'err' is never read
           err = -ENOBUFS;
           ^     ~~~~~~~~
   net/key/af_key.c:1182:3: 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(x->aalg->alg_name, a->name);
                   ^~~~~~
   net/key/af_key.c:1182:3: 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(x->aalg->alg_name, a->name);
                   ^~~~~~
   net/key/af_key.c:1204:4: 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(x->calg->alg_name, a->name);
                           ^~~~~~
   net/key/af_key.c:1204:4: 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(x->calg->alg_name, a->name);
                           ^~~~~~
   net/key/af_key.c:1221:4: 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(x->ealg->alg_name, a->name);
                           ^~~~~~
   net/key/af_key.c:1221:4: 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(x->ealg->alg_name, a->name);
                           ^~~~~~
   net/key/af_key.c:1486:44: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
           hdr->sadb_msg_satype = pfkey_proto2satype(x->id.proto);
                                                     ^
   net/key/af_key.c:3057:20: note: Assuming 'x' is null
           struct net *net = x ? xs_net(x) : c->net;

vim +116 drivers/net/dsa/mv88e6xxx/serdes-6352.c

   109	
   110	static int marvell_c22_pcs_modify(struct marvell_c22_pcs *mpcs, u8 reg,
   111					  u16 mask, u16 val)
   112	{
   113		int oldpage, err;
   114	
   115		oldpage = marvell_c22_pcs_set_fiber_page(mpcs);
 > 116		if (oldpage >= 0)
   117			err = __mdiobus_modify(mpcs->mdio.bus, mpcs->mdio.addr,
   118					       reg, mask, val);
   119	
   120		return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
   121	}
   122	
   123	static int marvell_c22_pcs_control_irq(struct marvell_c22_pcs *mpcs,
   124					       bool enable)
   125	{
   126		u16 val = enable ? MII_M1011_IMASK_LINK_CHANGE : 0;
   127	
   128		return marvell_c22_pcs_modify(mpcs, MII_M1011_IMASK,
   129					      MII_M1011_IMASK_LINK_CHANGE, val);
   130	}
   131	
   132	static int marvell_c22_pcs_enable(struct phylink_pcs *pcs)
   133	{
   134		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   135		int err;
   136	
   137		err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_PDOWN, 0);
   138		if (err || !mpcs->irq)
   139			return err;
   140	
   141		return marvell_c22_pcs_control_irq(mpcs, true);
   142	}
   143	
   144	static void marvell_c22_pcs_disable(struct phylink_pcs *pcs)
   145	{
   146		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   147	
   148		marvell_c22_pcs_control_irq(mpcs, false);
   149		marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_PDOWN, BMCR_PDOWN);
   150	}
   151	
   152	static void marvell_c22_pcs_get_state(struct phylink_pcs *pcs,
   153					    struct phylink_link_state *state)
   154	{
   155		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   156		int oldpage, bmsr, lpa;
   157	
   158		state->link = false;
   159	
   160		if (mpcs->link_check && !mpcs->link_check(mpcs))
   161			return;
   162	
   163		oldpage = marvell_c22_pcs_set_fiber_page(mpcs);
   164		if (oldpage >= 0) {
   165			bmsr = __mdiobus_read(mpcs->mdio.bus, mpcs->mdio.addr,
   166					      MII_BMSR);
   167			lpa = __mdiobus_read(mpcs->mdio.bus, mpcs->mdio.addr, MII_LPA);
   168		}
   169	
   170		if (marvell_c22_pcs_restore_page(mpcs, oldpage, 0) >= 0 &&
   171		    bmsr >= 0 && lpa >= 0)
   172			phylink_mii_c22_pcs_decode_state(state, bmsr, lpa);
   173	}
   174	
   175	static int marvell_c22_pcs_config(struct phylink_pcs *pcs,
   176					unsigned int mode,
   177				        phy_interface_t interface,
   178				        const unsigned long *advertise,
   179				        bool permit_pause_to_mac)
   180	{
   181		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   182		int oldpage, adv, err;
   183	
   184		adv = phylink_mii_c22_pcs_encode_advertisement(interface, advertise);
   185		if (adv < 0)
   186			return 0;
   187	
   188		oldpage = marvell_c22_pcs_set_fiber_page(mpcs);
 > 189		if (oldpage >= 0)
   190			err = __mdiobus_modify_changed(mpcs->mdio.bus, mpcs->mdio.addr,
   191						       MII_ADVERTISE, 0xffff, adv);
   192	
   193		return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
   194	}
   195	
   196	static void marvell_c22_pcs_an_restart(struct phylink_pcs *pcs)
   197	{
   198		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   199	
   200		marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_ANRESTART, BMCR_ANRESTART);
   201	}
   202	
   203	static void marvell_c22_pcs_link_up(struct phylink_pcs *pcs,
   204					  unsigned int mode,
   205					  phy_interface_t interface,
   206					  int speed, int duplex)
   207	{
   208		struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);
   209		u16 bmcr;
   210		int err;
   211	
   212		if (phylink_autoneg_inband(mode))
   213			return;
   214	
   215		switch (speed) {
   216		case SPEED_1000:
   217			bmcr = BMCR_SPEED1000;
   218			break;
   219		case SPEED_100:
   220			bmcr = BMCR_SPEED100;
   221			break;
   222		case SPEED_10:
   223			bmcr = 0;
   224			break;
   225		}
   226	
   227		if (duplex == DUPLEX_FULL)
 > 228			bmcr |= BMCR_FULLDPLX;
   229	
   230		err = marvell_c22_pcs_modify(mpcs, MII_BMCR, BMCR_SPEED100 |
   231					     BMCR_FULLDPLX | BMCR_SPEED1000, bmcr);
   232		if (err)
   233			dev_err(mpcs->mdio.dev.parent,
   234				"%s: failed to configure mpcs: %pe\n", mpcs->name,
   235				ERR_PTR(err));
   236	}
   237	

---
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: 35832 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-28  6:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28  6:11 [rmk-arm:zii 80/94] drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).