From: kernel test robot <lkp@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org
Subject: [toke:xdp-queueing-01 1/3] kernel/bpf/pifomap.c:146:6: warning: variable 'pkt' is used uninitialized whenever 'if' condition is false
Date: Sat, 10 Jul 2021 04:29:37 +0800 [thread overview]
Message-ID: <202107100431.lOaBcPic-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3297 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-01
head: 6b5756c44933d2b55e5e59e1196ef95894203cf7
commit: b8d0d0f924c237daf55b430a85007bd41ad01d7e [1/3] Add a PIFO map type for queueing packets
config: powerpc-randconfig-r026-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?id=b8d0d0f924c237daf55b430a85007bd41ad01d7e
git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git
git fetch --no-tags toke xdp-queueing-01
git checkout b8d0d0f924c237daf55b430a85007bd41ad01d7e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from kernel/bpf/pifomap.c:5:
In file included from include/linux/bpf.h:9:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:5:
In file included from include/linux/list.h:9:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:309:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^
>> kernel/bpf/pifomap.c:146:6: warning: variable 'pkt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (pktid < pifo->qsize)
^~~~~~~~~~~~~~~~~~~
kernel/bpf/pifomap.c:149:9: note: uninitialized use occurs here
return pkt ? &pkt->pkt_id : NULL;
^~~
kernel/bpf/pifomap.c:146:2: note: remove the 'if' if its condition is always true
if (pktid < pifo->qsize)
^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/pifomap.c:143:26: note: initialize the variable 'pkt' to silence this warning
struct bpf_pifo_pkt *pkt;
^
= NULL
2 warnings generated.
vim +146 kernel/bpf/pifomap.c
139
140 static void *pifo_map_lookup_elem(struct bpf_map *map, void *key)
141 {
142 struct bpf_pifo_map *pifo = container_of(map, struct bpf_pifo_map, map);
143 struct bpf_pifo_pkt *pkt;
144 u32 pktid = *(u32 *)key;
145
> 146 if (pktid < pifo->qsize)
147 pkt = &pifo->q[pktid];
148
149 return pkt ? &pkt->pkt_id : NULL;
150 }
151
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36508 bytes --]
reply other threads:[~2021-07-09 20:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202107100431.lOaBcPic-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=toke@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).