CC: [email protected]
CC: [email protected]
TO: "Luo, bin," <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   6929f71e46bdddbf1c4d67c2728648176c67c555
commit: 01f2b3dac8c4bebeb0ec15c4b7b59993766493cc hinic: add link_ksettings 
ethtool_ops support
date:   3 weeks ago
:::::: branch date: 7 hours ago
:::::: commit date: 3 weeks ago
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


cppcheck warnings: (new ones prefixed by >>)

>> net/netlink/genetlink.c:480:68: warning: Clarify calculation precedence for 
>> '&' and '?'. [clarifyCalculation]
    enum netlink_validation validate = ops->validate & no_strict_flag ?
                                                                      ^
--
>> net/ipv6/seg6.c:124:7: warning: Variable 'err' is reassigned a value before 
>> the old one has been used. [redundantAssignment]
     err = seg6_hmac_info_del(net, hmackeyid);
         ^
   net/ipv6/seg6.c:122:8: note: Variable 'err' is reassigned a value before the 
old one has been used.
      err = -ENOENT;
          ^
   net/ipv6/seg6.c:124:7: note: Variable 'err' is reassigned a value before the 
old one has been used.
     err = seg6_hmac_info_del(net, hmackeyid);
         ^
--
>> net/ipv6/seg6_iptunnel.c:333:6: warning: Variable 'err' is reassigned a 
>> value before the old one has been used. [redundantAssignment]
    err = seg6_do_srh(skb);
        ^
   net/ipv6/seg6_iptunnel.c:331:0: note: Variable 'err' is reassigned a value 
before the old one has been used.
    int err = -EINVAL;
   ^
   net/ipv6/seg6_iptunnel.c:333:6: note: Variable 'err' is reassigned a value 
before the old one has been used.
    err = seg6_do_srh(skb);
        ^
>> net/ipv6/seg6_local.c:434:6: warning: Variable 'err' is reassigned a value 
>> before the old one has been used. [redundantAssignment]
    err = seg6_do_srh_inline(skb, slwt->srh);
        ^
   net/ipv6/seg6_local.c:428:0: note: Variable 'err' is reassigned a value 
before the old one has been used.
    int err = -EINVAL;
   ^
   net/ipv6/seg6_local.c:434:6: note: Variable 'err' is reassigned a value 
before the old one has been used.
    err = seg6_do_srh_inline(skb, slwt->srh);
        ^
   net/ipv6/seg6_local.c:466:6: warning: Variable 'err' is reassigned a value 
before the old one has been used. [redundantAssignment]
    err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6);
        ^
   net/ipv6/seg6_local.c:455:0: note: Variable 'err' is reassigned a value 
before the old one has been used.
    int err = -EINVAL;
   ^
   net/ipv6/seg6_local.c:466:6: note: Variable 'err' is reassigned a value 
before the old one has been used.
    err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6);
        ^
>> net/tipc/crypto.c:1126:5: warning: Variable 'rc' is reassigned a value 
>> before the old one has been used. [redundantAssignment]
    rc = new_key;
       ^
   net/tipc/crypto.c:1082:0: note: Variable 'rc' is reassigned a value before 
the old one has been used.
    int rc = -EBUSY;
   ^
   net/tipc/crypto.c:1126:5: note: Variable 'rc' is reassigned a value before 
the old one has been used.
    rc = new_key;
       ^
   lib/xxhash.c:273:33: warning: Either the condition 'input==NULL' is 
redundant or there is pointer arithmetic with NULL pointer. 
[nullPointerArithmeticRedundantCheck]
    const uint8_t *const b_end = p + len;
                                   ^
   lib/xxhash.c:275:12: note: Assuming that condition 'input==NULL' is not 
redundant
    if (input == NULL)
              ^
   lib/xxhash.c:272:21: note: Assignment 'p=(const uint8_t*)input', assigned 
value is 0
    const uint8_t *p = (const uint8_t *)input;
                       ^
   lib/xxhash.c:273:33: note: Null pointer addition
    const uint8_t *const b_end = p + len;
                                   ^
   lib/xxhash.c:380:33: warning: Either the condition 'input==NULL' is 
redundant or there is pointer arithmetic with NULL pointer. 
[nullPointerArithmeticRedundantCheck]
    const uint8_t *const b_end = p + len;
                                   ^
   lib/xxhash.c:382:12: note: Assuming that condition 'input==NULL' is not 
redundant
    if (input == NULL)
              ^
   lib/xxhash.c:379:21: note: Assignment 'p=(const uint8_t*)input', assigned 
value is 0
    const uint8_t *p = (const uint8_t *)input;
                       ^
   lib/xxhash.c:380:33: note: Null pointer addition
    const uint8_t *const b_end = p + len;
                                   ^
>> lib/xxhash.c:300:3: warning: Variable 'p32' is modified but its new value is 
>> never used. [unreadVariable]
     p32++;
     ^
--
>> drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:463:26: warning: Undefined 
>> behavior: Variable 'set_link_str' is used as parameter and destination in 
>> s[n]printf(). [sprintfOverlappingData]
             "%sspeed %d ", set_link_str, speed);
                            ^

# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01f2b3dac8c4bebeb0ec15c4b7b59993766493cc
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 01f2b3dac8c4bebeb0ec15c4b7b59993766493cc
vim +/set_link_str +463 drivers/net/ethernet/huawei/hinic/hinic_ethtool.c

01f2b3dac8c4be Luo bin 2020-05-11  441  
01f2b3dac8c4be Luo bin 2020-05-11  442  static int 
hinic_set_settings_to_hw(struct hinic_dev *nic_dev,
01f2b3dac8c4be Luo bin 2020-05-11  443                                      u32 
set_settings, u8 autoneg, u32 speed)
01f2b3dac8c4be Luo bin 2020-05-11  444  {
01f2b3dac8c4be Luo bin 2020-05-11  445          struct 
hinic_link_ksettings_info settings = {0};
01f2b3dac8c4be Luo bin 2020-05-11  446          char 
set_link_str[SET_LINK_STR_MAX_LEN] = {0};
01f2b3dac8c4be Luo bin 2020-05-11  447          struct net_device *netdev = 
nic_dev->netdev;
01f2b3dac8c4be Luo bin 2020-05-11  448          enum nic_speed_level 
speed_level = 0;
01f2b3dac8c4be Luo bin 2020-05-11  449          int err;
01f2b3dac8c4be Luo bin 2020-05-11  450  
01f2b3dac8c4be Luo bin 2020-05-11  451          err = snprintf(set_link_str, 
SET_LINK_STR_MAX_LEN, "%s",
01f2b3dac8c4be Luo bin 2020-05-11  452                         (set_settings & 
HILINK_LINK_SET_AUTONEG) ?
01f2b3dac8c4be Luo bin 2020-05-11  453                         (autoneg ? 
"autong enable " : "autong disable ") : "");
01f2b3dac8c4be Luo bin 2020-05-11  454          if (err < 0 || err >= 
SET_LINK_STR_MAX_LEN) {
01f2b3dac8c4be Luo bin 2020-05-11  455                  netif_err(nic_dev, drv, 
netdev, "Failed to snprintf link state, function return(%d) and dest_len(%d)\n",
01f2b3dac8c4be Luo bin 2020-05-11  456                            err, 
SET_LINK_STR_MAX_LEN);
01f2b3dac8c4be Luo bin 2020-05-11  457                  return -EFAULT;
01f2b3dac8c4be Luo bin 2020-05-11  458          }
01f2b3dac8c4be Luo bin 2020-05-11  459  
01f2b3dac8c4be Luo bin 2020-05-11  460          if (set_settings & 
HILINK_LINK_SET_SPEED) {
01f2b3dac8c4be Luo bin 2020-05-11  461                  speed_level = 
hinic_ethtool_to_hw_speed_level(speed);
01f2b3dac8c4be Luo bin 2020-05-11  462                  err = 
snprintf(set_link_str, SET_LINK_STR_MAX_LEN,
01f2b3dac8c4be Luo bin 2020-05-11 @463                                 "%sspeed 
%d ", set_link_str, speed);
01f2b3dac8c4be Luo bin 2020-05-11  464                  if (err <= 0 || err >= 
SET_LINK_STR_MAX_LEN) {
01f2b3dac8c4be Luo bin 2020-05-11  465                          
netif_err(nic_dev, drv, netdev, "Failed to snprintf link speed, function 
return(%d) and dest_len(%d)\n",
01f2b3dac8c4be Luo bin 2020-05-11  466                                    err, 
SET_LINK_STR_MAX_LEN);
01f2b3dac8c4be Luo bin 2020-05-11  467                          return -EFAULT;
01f2b3dac8c4be Luo bin 2020-05-11  468                  }
01f2b3dac8c4be Luo bin 2020-05-11  469          }
01f2b3dac8c4be Luo bin 2020-05-11  470  
01f2b3dac8c4be Luo bin 2020-05-11  471          settings.func_id = 
HINIC_HWIF_FUNC_IDX(nic_dev->hwdev->hwif);
01f2b3dac8c4be Luo bin 2020-05-11  472          settings.valid_bitmap = 
set_settings;
01f2b3dac8c4be Luo bin 2020-05-11  473          settings.autoneg = autoneg;
01f2b3dac8c4be Luo bin 2020-05-11  474          settings.speed = speed_level;
01f2b3dac8c4be Luo bin 2020-05-11  475  
01f2b3dac8c4be Luo bin 2020-05-11  476          err = 
hinic_set_link_settings(nic_dev->hwdev, &settings);
01f2b3dac8c4be Luo bin 2020-05-11  477          if (err != 
HINIC_MGMT_CMD_UNSUPPORTED) {
01f2b3dac8c4be Luo bin 2020-05-11  478                  if (err)
01f2b3dac8c4be Luo bin 2020-05-11  479                          
netif_err(nic_dev, drv, netdev, "Set %s failed\n",
01f2b3dac8c4be Luo bin 2020-05-11  480                                    
set_link_str);
01f2b3dac8c4be Luo bin 2020-05-11  481                  else
01f2b3dac8c4be Luo bin 2020-05-11  482                          
netif_info(nic_dev, drv, netdev, "Set %s successfully\n",
01f2b3dac8c4be Luo bin 2020-05-11  483                                     
set_link_str);
01f2b3dac8c4be Luo bin 2020-05-11  484  
01f2b3dac8c4be Luo bin 2020-05-11  485                  return err;
01f2b3dac8c4be Luo bin 2020-05-11  486          }
01f2b3dac8c4be Luo bin 2020-05-11  487  
01f2b3dac8c4be Luo bin 2020-05-11  488          return 
set_link_settings_separate_cmd(nic_dev, set_settings, autoneg,
01f2b3dac8c4be Luo bin 2020-05-11  489                                          
      speed);
01f2b3dac8c4be Luo bin 2020-05-11  490  }
01f2b3dac8c4be Luo bin 2020-05-11  491  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to