From: kernel test robot <lkp@intel.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
Daniel Borkmann <daniel@iogearbox.net>,
linux-kernel@vger.kernel.org
Subject: [cilium:pr/meta5 4/4] kernel/bpf/net.c:52:28: warning: variable 'peer' is uninitialized when used here
Date: Wed, 13 Jul 2022 19:24:21 +0800 [thread overview]
Message-ID: <202207131941.ZTw3SDaO-lkp@intel.com> (raw)
tree: https://github.com/cilium/linux.git pr/meta5
head: 3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
commit: 3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5 [4/4] bpf: Add fd-based API to attach tc BPF programs
config: hexagon-randconfig-r003-20220712 (https://download.01.org/0day-ci/archive/20220713/202207131941.ZTw3SDaO-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e60b4fb2b777118c0ff664a6347851df14fcf75b)
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/cilium/linux/commit/3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
git remote add cilium https://github.com/cilium/linux.git
git fetch --no-tags cilium pr/meta5
git checkout 3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/bpf/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> kernel/bpf/net.c:52:28: warning: variable 'peer' is uninitialized when used here [-Wuninitialized]
dev_sch_entry_prio_set(peer, prio, nprog);
^~~~
kernel/bpf/net.c:33:32: note: initialize the variable 'peer' to silence this warning
struct sch_entry *entry, *peer;
^
= NULL
1 warning generated.
vim +/peer +52 kernel/bpf/net.c
28
29 static int __sch_prog_attach(struct net_device *dev, bool ingress, u32 limit,
30 struct bpf_prog *nprog, u32 prio, u32 flags)
31 {
32 struct bpf_prog_array_item *item, *tmp;
33 struct sch_entry *entry, *peer;
34 struct bpf_prog *oprog;
35 bool created;
36 int i, j;
37
38 entry = dev_sch_entry_fetch(dev, ingress, &created);
39 if (!entry)
40 return -ENOMEM;
41 for (i = 0; i < limit; i++) {
42 item = &entry->items[i];
43 oprog = item->prog;
44 if (!oprog)
45 break;
46 if (item->bpf_priority == prio) {
47 if (flags & BPF_F_REPLACE) {
48 /* Pairs with READ_ONCE() in sch_run_progs(). */
49 WRITE_ONCE(item->prog, nprog);
50 if (sch_prog_refcounted(oprog))
51 bpf_prog_put(oprog);
> 52 dev_sch_entry_prio_set(peer, prio, nprog);
53 return prio;
54 }
55 return -EBUSY;
56 }
57 }
58 if (dev_sch_entry_total(entry) >= limit)
59 return -ENOSPC;
60 prio = dev_sch_entry_prio_new(entry, prio, nprog);
61 if (prio < 0) {
62 if (created)
63 dev_sch_entry_free(entry);
64 return -ENOMEM;
65 }
66 peer = dev_sch_entry_peer(entry);
67 dev_sch_entry_clear(peer);
68 for (i = 0, j = 0; i < limit; i++, j++) {
69 item = &entry->items[i];
70 tmp = &peer->items[j];
71 oprog = item->prog;
72 if (!oprog) {
73 if (i == j) {
74 tmp->prog = nprog;
75 tmp->bpf_priority = prio;
76 }
77 break;
78 } else if (item->bpf_priority < prio) {
79 tmp->prog = oprog;
80 tmp->bpf_priority = item->bpf_priority;
81 } else if (item->bpf_priority > prio) {
82 if (i == j) {
83 tmp->prog = nprog;
84 tmp->bpf_priority = prio;
85 tmp = &peer->items[++j];
86 }
87 tmp->prog = oprog;
88 tmp->bpf_priority = item->bpf_priority;
89 }
90 }
91 dev_sch_entry_update(dev, peer, ingress);
92 if (ingress)
93 net_inc_ingress_queue();
94 else
95 net_inc_egress_queue();
96 return prio;
97 }
98
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next reply other threads:[~2022-07-13 11:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 11:24 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-13 11:24 [cilium:pr/meta5 4/4] kernel/bpf/net.c:52:28: warning: variable 'peer' is uninitialized when used here kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202207131941.ZTw3SDaO-lkp@intel.com \
--to=lkp@intel.com \
--cc=daniel@iogearbox.net \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.