[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107100431.lOaBcPic-lkp@intel.com>
Date: Sat, 10 Jul 2021 04:29:37 +0800
From: kernel test robot <lkp@...el.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
linux-kernel@...r.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
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@...el.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
Download attachment ".config.gz" of type "application/gzip" (36508 bytes)
Powered by blists - more mailing lists