[toke:xdp-queueing-01 1/3] kernel/bpf/pifomap.c:149 pifo_map_lookup_elem() error: uninitialized symbol 'pkt'.
From: Dan Carpenter
Date: Sat Jul 10 2021 - 10:51:47 EST
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: i386-randconfig-m021-20210709 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
smatch warnings:
kernel/bpf/pifomap.c:149 pifo_map_lookup_elem() error: uninitialized symbol 'pkt'.
vim +/pkt +149 kernel/bpf/pifomap.c
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 140 static void *pifo_map_lookup_elem(struct bpf_map *map, void *key)
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 141 {
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 142 struct bpf_pifo_map *pifo = container_of(map, struct bpf_pifo_map, map);
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 143 struct bpf_pifo_pkt *pkt;
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 144 u32 pktid = *(u32 *)key;
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 145
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 146 if (pktid < pifo->qsize)
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 147 pkt = &pifo->q[pktid];
Not initialized on else path.
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 148
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 @149 return pkt ? &pkt->pkt_id : NULL;
^^^
b8d0d0f924c237 Toke Høiland-Jørgensen 2021-06-30 150 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx