linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [toke:xdp-queueing-01 1/3] kernel/bpf/pifomap.c:146:6: warning: variable 'pkt' is used uninitialized whenever 'if' condition is false
@ 2021-07-09 20:29 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-09 20:29 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: clang-built-linux, kbuild-all, linux-kernel

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-09 20:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 20:29 [toke:xdp-queueing-01 1/3] kernel/bpf/pifomap.c:146:6: warning: variable 'pkt' is used uninitialized whenever 'if' condition is false kernel test robot

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).