Hi Cong,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    
https://github.com/0day-ci/linux/commits/Cong-Wang/mlx5-fixup-checksum-for-ethernet-padding/20181130-014928
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=ia64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/mellanox/mlx5/core/en_rx.c: In function 
'mlx5e_csum_padding':
>> drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:740:6: warning: 'pad_offset' 
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
     u32 pad_offset, pad_len;
         ^~~~~~~~~~

vim +/pad_offset +740 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

   734  
   735  static void mlx5e_csum_padding(struct sk_buff *skb, int network_depth,
   736                                 __be16 proto, bool has_fcs)
   737  {
   738          u32 frame_len = has_fcs ? skb->len - ETH_FCS_LEN : skb->len;
   739          void *ip_p = skb->data + network_depth;
 > 740          u32 pad_offset, pad_len;
   741          void *pad;
   742  
   743          if (likely(frame_len > ETH_ZLEN))
   744                  return;
   745  
   746          if (proto == htons(ETH_P_IP)) {
   747                  struct iphdr *ipv4 = ip_p;
   748  
   749                  pad_offset =  network_depth + 
be16_to_cpu(ipv4->tot_len);
   750          } else if (proto == htons(ETH_P_IPV6)) {
   751                  struct ipv6hdr *ipv6 = ip_p;
   752  
   753                  pad_offset = network_depth + sizeof(struct ipv6hdr) +
   754                               be16_to_cpu(ipv6->payload_len);
   755          }
   756  
   757          pad = skb->data + pad_offset;
   758          pad_len = frame_len - pad_offset;
   759  
   760          skb->csum = csum_block_add(skb->csum, csum_partial(pad, 
pad_len, 0),
   761                                     pad_offset);
   762  }
   763  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to