[dborkman-bpf:pr/bpf-tstamp 3/3] drivers/net/ethernet/intel/fm10k/fm10k_main.c:878:16: warning: division by zero is undefined

From: kernel test robot
Date: Fri Nov 05 2021 - 20:45:28 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/bpf-tstamp
head: f7d619a946e981177777983af26e9e31163ffb38
commit: f7d619a946e981177777983af26e9e31163ffb38 [3/3] net: skb clock bases
config: x86_64-randconfig-a006-20210928 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git/commit/?id=f7d619a946e981177777983af26e9e31163ffb38
git remote add dborkman-bpf https://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git
git fetch --no-tags dborkman-bpf pr/bpf-tstamp
git checkout f7d619a946e981177777983af26e9e31163ffb38
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

In file included from drivers/net/ethernet/intel/fm10k/fm10k_main.c:8:
include/net/tcp.h:812:27: error: no member named 'skb_mstamp_ns' in 'struct sk_buff'
return tcp_ns_to_ts(skb->skb_mstamp_ns);
~~~ ^
include/net/tcp.h:818:22: error: no member named 'skb_mstamp_ns' in 'struct sk_buff'
return div_u64(skb->skb_mstamp_ns, NSEC_PER_USEC);
~~~ ^
include/net/tcp.h:2367:8: error: no member named 'skb_mstamp_ns' in 'struct sk_buff'
skb->skb_mstamp_ns += (u64)tp->tcp_tx_delay * NSEC_PER_USEC;
~~~ ^
>> drivers/net/ethernet/intel/fm10k/fm10k_main.c:878:16: warning: division by zero is undefined [-Wdivision-by-zero]
desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/fm10k/fm10k_main.c:870:26: note: expanded from macro 'FM10K_SET_FLAG'
((u32)(_input & _flag) / (_flag / _result)))
^ ~~~~~~~~~~~~~~~~~
1 warning and 3 errors generated.


vim +878 drivers/net/ethernet/intel/fm10k/fm10k_main.c

76a540d4728a37 Alexander Duyck 2014-09-20 866
76a540d4728a37 Alexander Duyck 2014-09-20 867 #define FM10K_SET_FLAG(_input, _flag, _result) \
76a540d4728a37 Alexander Duyck 2014-09-20 868 ((_flag <= _result) ? \
76a540d4728a37 Alexander Duyck 2014-09-20 869 ((u32)(_input & _flag) * (_result / _flag)) : \
76a540d4728a37 Alexander Duyck 2014-09-20 870 ((u32)(_input & _flag) / (_flag / _result)))
76a540d4728a37 Alexander Duyck 2014-09-20 871
76a540d4728a37 Alexander Duyck 2014-09-20 872 static u8 fm10k_tx_desc_flags(struct sk_buff *skb, u32 tx_flags)
76a540d4728a37 Alexander Duyck 2014-09-20 873 {
76a540d4728a37 Alexander Duyck 2014-09-20 874 /* set type for advanced descriptor with frame checksum insertion */
76a540d4728a37 Alexander Duyck 2014-09-20 875 u32 desc_flags = 0;
76a540d4728a37 Alexander Duyck 2014-09-20 876
76a540d4728a37 Alexander Duyck 2014-09-20 877 /* set checksum offload bits */
76a540d4728a37 Alexander Duyck 2014-09-20 @878 desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM,
76a540d4728a37 Alexander Duyck 2014-09-20 879 FM10K_TXD_FLAG_CSUM);
76a540d4728a37 Alexander Duyck 2014-09-20 880
76a540d4728a37 Alexander Duyck 2014-09-20 881 return desc_flags;
76a540d4728a37 Alexander Duyck 2014-09-20 882 }
76a540d4728a37 Alexander Duyck 2014-09-20 883

:::::: The code at line 878 was first introduced by commit
:::::: 76a540d4728a379e022fb2e2e8766d502b6d345c fm10k: Add support for netdev offloads

:::::: TO: Alexander Duyck <alexander.h.duyck@xxxxxxxxx>
:::::: CC: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip