BCC: [email protected]
CC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Alexei Starovoitov <[email protected]>
CC: Daniel Borkmann <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   d5538ab91d3a9a237805be6f8c6c272af2987995
commit: 7c8199e24fa09d2344ae0204527d55d7803e8409 [4493/7639] bpf: Introduce any 
context BPF specific memory allocator.
:::::: branch date: 28 hours ago
:::::: commit date: 12 days ago
config: ia64-randconfig-m031-20220915 
(https://download.01.org/0day-ci/archive/20220917/[email protected]/config)
compiler: ia64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
kernel/bpf/memalloc.c:344 bpf_mem_alloc_destroy() error: potentially 
dereferencing uninitialized 'c'.

vim +/c +344 kernel/bpf/memalloc.c

7c8199e24fa09d Alexei Starovoitov 2022-09-02  331  
7c8199e24fa09d Alexei Starovoitov 2022-09-02  332  void 
bpf_mem_alloc_destroy(struct bpf_mem_alloc *ma)
7c8199e24fa09d Alexei Starovoitov 2022-09-02  333  {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  334       struct bpf_mem_caches 
*cc;
7c8199e24fa09d Alexei Starovoitov 2022-09-02  335       struct bpf_mem_cache *c;
7c8199e24fa09d Alexei Starovoitov 2022-09-02  336       int cpu, i;
7c8199e24fa09d Alexei Starovoitov 2022-09-02  337  
7c8199e24fa09d Alexei Starovoitov 2022-09-02  338       if (ma->cache) {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  339               
for_each_possible_cpu(cpu) {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  340                       c = 
per_cpu_ptr(ma->cache, cpu);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  341                       
drain_mem_cache(c);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  342               }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  343               /* kmem_cache 
and memcg are the same across cpus */
7c8199e24fa09d Alexei Starovoitov 2022-09-02 @344               
kmem_cache_destroy(c->kmem_cache);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  345               if (c->objcg)
7c8199e24fa09d Alexei Starovoitov 2022-09-02  346                       
obj_cgroup_put(c->objcg);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  347               
free_percpu(ma->cache);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  348               ma->cache = 
NULL;
7c8199e24fa09d Alexei Starovoitov 2022-09-02  349       }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  350       if (ma->caches) {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  351               
for_each_possible_cpu(cpu) {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  352                       cc = 
per_cpu_ptr(ma->caches, cpu);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  353                       for (i 
= 0; i < NUM_CACHES; i++) {
7c8199e24fa09d Alexei Starovoitov 2022-09-02  354                               
c = &cc->cache[i];
7c8199e24fa09d Alexei Starovoitov 2022-09-02  355                               
drain_mem_cache(c);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  356                       }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  357               }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  358               if (c->objcg)
7c8199e24fa09d Alexei Starovoitov 2022-09-02  359                       
obj_cgroup_put(c->objcg);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  360               
free_percpu(ma->caches);
7c8199e24fa09d Alexei Starovoitov 2022-09-02  361               ma->caches = 
NULL;
7c8199e24fa09d Alexei Starovoitov 2022-09-02  362       }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  363  }
7c8199e24fa09d Alexei Starovoitov 2022-09-02  364  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to