[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202110141607.c3E3Y7ZD-lkp@intel.com>
Date: Thu, 14 Oct 2021 16:25:55 +0800
From: kernel test robot <lkp@...el.com>
To: Jeremy Kerr <jk@...econstruct.com.au>, netdev@...r.kernel.org
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
Matt Johnston <matt@...econstruct.com.au>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next v2] mctp: Implement extended addressing
Hi Jeremy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jeremy-Kerr/mctp-Implement-extended-addressing/20211014-103942
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 39e222bfd7f37e7a98069869375b903d7096c113
config: hexagon-randconfig-r041-20211014 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6c76d0101193aa4eb891a6954ff047eda2f9cf71)
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://github.com/0day-ci/linux/commit/2fed3ce68e4fc1a6f8faaa838ce84829cd030f6b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jeremy-Kerr/mctp-Implement-extended-addressing/20211014-103942
git checkout 2fed3ce68e4fc1a6f8faaa838ce84829cd030f6b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> net/mctp/route.c:752:7: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (WARN_ON(!rt->dev))
^~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:120:28: note: expanded from macro 'WARN_ON'
#define WARN_ON(condition) ({ \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mctp/route.c:838:9: note: uninitialized use occurs here
return rc;
^~
net/mctp/route.c:752:3: note: remove the 'if' if its condition is always false
if (WARN_ON(!rt->dev))
^~~~~~~~~~~~~~~~~~~~~~
net/mctp/route.c:745:8: note: initialize the variable 'rc' to silence this warning
int rc;
^
= 0
1 warning generated.
vim +752 net/mctp/route.c
4a992bbd365094 Jeremy Kerr 2021-07-29 732
889b7da23abf92 Jeremy Kerr 2021-07-29 733 int mctp_local_output(struct sock *sk, struct mctp_route *rt,
889b7da23abf92 Jeremy Kerr 2021-07-29 734 struct sk_buff *skb, mctp_eid_t daddr, u8 req_tag)
889b7da23abf92 Jeremy Kerr 2021-07-29 735 {
833ef3b91de692 Jeremy Kerr 2021-07-29 736 struct mctp_sock *msk = container_of(sk, struct mctp_sock, sk);
889b7da23abf92 Jeremy Kerr 2021-07-29 737 struct mctp_skb_cb *cb = mctp_cb(skb);
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 738 struct mctp_route tmp_rt;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 739 struct net_device *dev;
889b7da23abf92 Jeremy Kerr 2021-07-29 740 struct mctp_hdr *hdr;
889b7da23abf92 Jeremy Kerr 2021-07-29 741 unsigned long flags;
4a992bbd365094 Jeremy Kerr 2021-07-29 742 unsigned int mtu;
889b7da23abf92 Jeremy Kerr 2021-07-29 743 mctp_eid_t saddr;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 744 bool ext_rt;
889b7da23abf92 Jeremy Kerr 2021-07-29 745 int rc;
833ef3b91de692 Jeremy Kerr 2021-07-29 746 u8 tag;
889b7da23abf92 Jeremy Kerr 2021-07-29 747
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 748 if (rt) {
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 749 ext_rt = false;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 750 dev = NULL;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 751
889b7da23abf92 Jeremy Kerr 2021-07-29 @752 if (WARN_ON(!rt->dev))
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 753 goto out_release;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 754
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 755 } else if (cb->ifindex) {
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 756 ext_rt = true;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 757 rt = &tmp_rt;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 758
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 759 rc = -ENODEV;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 760 rcu_read_lock();
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 761 dev = dev_get_by_index_rcu(sock_net(sk), cb->ifindex);
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 762 if (!dev) {
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 763 rcu_read_unlock();
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 764 return rc;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 765 }
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 766
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 767 rt->dev = __mctp_dev_get(dev);
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 768 rcu_read_unlock();
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 769
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 770 if (!rt->dev)
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 771 goto out_release;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 772
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 773 /* establish temporary route - we set up enough to keep
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 774 * mctp_route_output happy
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 775 */
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 776 rt->output = mctp_route_output;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 777 rt->mtu = 0;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 778
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 779 } else {
889b7da23abf92 Jeremy Kerr 2021-07-29 780 return -EINVAL;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 781 }
889b7da23abf92 Jeremy Kerr 2021-07-29 782
889b7da23abf92 Jeremy Kerr 2021-07-29 783 spin_lock_irqsave(&rt->dev->addrs_lock, flags);
889b7da23abf92 Jeremy Kerr 2021-07-29 784 if (rt->dev->num_addrs == 0) {
889b7da23abf92 Jeremy Kerr 2021-07-29 785 rc = -EHOSTUNREACH;
889b7da23abf92 Jeremy Kerr 2021-07-29 786 } else {
889b7da23abf92 Jeremy Kerr 2021-07-29 787 /* use the outbound interface's first address as our source */
889b7da23abf92 Jeremy Kerr 2021-07-29 788 saddr = rt->dev->addrs[0];
889b7da23abf92 Jeremy Kerr 2021-07-29 789 rc = 0;
889b7da23abf92 Jeremy Kerr 2021-07-29 790 }
889b7da23abf92 Jeremy Kerr 2021-07-29 791 spin_unlock_irqrestore(&rt->dev->addrs_lock, flags);
889b7da23abf92 Jeremy Kerr 2021-07-29 792
889b7da23abf92 Jeremy Kerr 2021-07-29 793 if (rc)
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 794 goto out_release;
889b7da23abf92 Jeremy Kerr 2021-07-29 795
833ef3b91de692 Jeremy Kerr 2021-07-29 796 if (req_tag & MCTP_HDR_FLAG_TO) {
833ef3b91de692 Jeremy Kerr 2021-07-29 797 rc = mctp_alloc_local_tag(msk, saddr, daddr, &tag);
833ef3b91de692 Jeremy Kerr 2021-07-29 798 if (rc)
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 799 goto out_release;
833ef3b91de692 Jeremy Kerr 2021-07-29 800 tag |= MCTP_HDR_FLAG_TO;
833ef3b91de692 Jeremy Kerr 2021-07-29 801 } else {
833ef3b91de692 Jeremy Kerr 2021-07-29 802 tag = req_tag;
833ef3b91de692 Jeremy Kerr 2021-07-29 803 }
833ef3b91de692 Jeremy Kerr 2021-07-29 804
4a992bbd365094 Jeremy Kerr 2021-07-29 805 skb->protocol = htons(ETH_P_MCTP);
4a992bbd365094 Jeremy Kerr 2021-07-29 806 skb->priority = 0;
889b7da23abf92 Jeremy Kerr 2021-07-29 807 skb_reset_transport_header(skb);
889b7da23abf92 Jeremy Kerr 2021-07-29 808 skb_push(skb, sizeof(struct mctp_hdr));
889b7da23abf92 Jeremy Kerr 2021-07-29 809 skb_reset_network_header(skb);
4a992bbd365094 Jeremy Kerr 2021-07-29 810 skb->dev = rt->dev->dev;
4a992bbd365094 Jeremy Kerr 2021-07-29 811
4a992bbd365094 Jeremy Kerr 2021-07-29 812 /* cb->net will have been set on initial ingress */
4a992bbd365094 Jeremy Kerr 2021-07-29 813 cb->src = saddr;
4a992bbd365094 Jeremy Kerr 2021-07-29 814
4a992bbd365094 Jeremy Kerr 2021-07-29 815 /* set up common header fields */
889b7da23abf92 Jeremy Kerr 2021-07-29 816 hdr = mctp_hdr(skb);
889b7da23abf92 Jeremy Kerr 2021-07-29 817 hdr->ver = 1;
889b7da23abf92 Jeremy Kerr 2021-07-29 818 hdr->dest = daddr;
889b7da23abf92 Jeremy Kerr 2021-07-29 819 hdr->src = saddr;
889b7da23abf92 Jeremy Kerr 2021-07-29 820
4a992bbd365094 Jeremy Kerr 2021-07-29 821 mtu = mctp_route_mtu(rt);
889b7da23abf92 Jeremy Kerr 2021-07-29 822
4a992bbd365094 Jeremy Kerr 2021-07-29 823 if (skb->len + sizeof(struct mctp_hdr) <= mtu) {
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 824 hdr->flags_seq_tag = MCTP_HDR_FLAG_SOM |
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 825 MCTP_HDR_FLAG_EOM | tag;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 826 rc = rt->output(rt, skb);
4a992bbd365094 Jeremy Kerr 2021-07-29 827 } else {
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 828 rc = mctp_do_fragment_route(rt, skb, mtu, tag);
4a992bbd365094 Jeremy Kerr 2021-07-29 829 }
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 830
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 831 out_release:
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 832 if (!ext_rt)
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 833 mctp_route_release(rt);
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 834
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 835 if (dev)
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 836 dev_put(dev);
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 837
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 838 return rc;
2fed3ce68e4fc1 Jeremy Kerr 2021-10-14 839
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (40487 bytes)
Powered by blists - more mailing lists