CC: [email protected]
BCC: [email protected]
TO: Ammar Faizi <[email protected]>

tree:   https://github.com/ammarfaizi2/linux-block 
google/android/kernel/common/android13-5.10
head:   aadf7ad9db2f7d93ecfb34d0e4f328519460c94e
commit: 372b24bad2a8e7994d0360c870f6e981e3f4bb8f [942/9999] ANDROID: GKI: Add 
OEM data to mutex/rwsem
:::::: branch date: 4 weeks ago
:::::: commit date: 11 months ago
config: arm-randconfig-c002-20220425 
(https://download.01.org/0day-ci/archive/20220427/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
1cddcfdc3c683b393df1a5c9063252eb60e52818)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # 
https://github.com/ammarfaizi2/linux-block/commit/372b24bad2a8e7994d0360c870f6e981e3f4bb8f
        git remote add ammarfaizi2-block 
https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block 
google/android/kernel/common/android13-5.10
        git checkout 372b24bad2a8e7994d0360c870f6e981e3f4bb8f
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:517:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/dma/sf-pdma/sf-pdma.c:59:6: warning: Access to field 'desc' results 
in a dereference of a null pointer (loaded from variable 'chan') 
[clang-analyzer-core.NullDereference]
           if (chan->desc && !chan->desc->in_use) {
               ^
   drivers/dma/sf-pdma/sf-pdma.c:95:30: note: Calling 'to_sf_pdma_chan'
           struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
                                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Left side of '&&' is false
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
                  ^
   include/linux/kernel.h:853:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Taking false branch
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
                  ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:323:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:311:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:303:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Loop condition is false.  Exiting 
loop
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
                  ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:323:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:311:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:301:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/dma/sf-pdma/sf-pdma.c:44:2: note: Returning pointer, which 
participates in a condition later
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:44:2: note: Returning pointer
           return container_of(dchan, struct sf_pdma_chan, vchan.chan);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:95:30: note: Returning from 'to_sf_pdma_chan'
           struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
                                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:95:2: note: 'chan' initialized here
           struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:98:6: note: Assuming 'chan' is null
           if (chan && (!len || !dest || !src)) {
               ^~~~
   drivers/dma/sf-pdma/sf-pdma.c:98:11: note: Left side of '&&' is false
           if (chan && (!len || !dest || !src)) {
                    ^
   drivers/dma/sf-pdma/sf-pdma.c:104:28: note: Passing null pointer value via 
1st parameter 'chan'
           desc = sf_pdma_alloc_desc(chan);
                                     ^~~~
   drivers/dma/sf-pdma/sf-pdma.c:104:9: note: Calling 'sf_pdma_alloc_desc'
           desc = sf_pdma_alloc_desc(chan);
                  ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/sf-pdma/sf-pdma.c:57:2: note: Loop condition is false.  Exiting 
loop
           spin_lock_irqsave(&chan->lock, flags);
           ^
   include/linux/spinlock.h:384:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:250:2: note: expanded from macro 
'raw_spin_lock_irqsave'
           do {                                            \
           ^
   drivers/dma/sf-pdma/sf-pdma.c:57:2: note: Loop condition is false.  Exiting 
loop
           spin_lock_irqsave(&chan->lock, flags);
           ^
   include/linux/spinlock.h:382:43: note: expanded from macro 
'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   drivers/dma/sf-pdma/sf-pdma.c:59:6: note: Access to field 'desc' results in 
a dereference of a null pointer (loaded from variable 'chan')
           if (chan->desc && !chan->desc->in_use) {
               ^~~~
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
>> kernel/bpf/bpf_struct_ops.c:30:8: warning: Excessive padding in 'struct 
>> bpf_struct_ops_map' (32 padding bytes, where 0 is optimal). 
   Optimal fields order: 
   map, 
   lock, 
   st_ops, 
   progs, 
   image, 
   uvalue, 
   kvalue, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct bpf_struct_ops_map {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~
   kernel/bpf/bpf_struct_ops.c:30:8: note: Excessive padding in 'struct 
bpf_struct_ops_map' (32 padding bytes, where 0 is optimal). Optimal fields 
order: map, lock, st_ops, progs, image, uvalue, kvalue, consider reordering the 
fields or adding explicit padding members
   struct bpf_struct_ops_map {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~
   Suppressed 9 warnings (8 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   12 warnings generated.
   kernel/events/core.c:3700:35: warning: Access to field 'ctx' results in a 
dereference of a null pointer (loaded from variable 'event') 
[clang-analyzer-core.NullDereference]
           struct perf_event_context *ctx = event->ctx;
                                            ^
   kernel/events/core.c:13112:2: note: Calling 'perf_cgroup_switch'
           perf_cgroup_switch(task, PERF_CGROUP_SWOUT | PERF_CGROUP_SWIN);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/events/core.c:812:2: note: Loop condition is false.  Exiting loop
           local_irq_save(flags);
           ^
   include/linux/irqflags.h:202:3: note: expanded from macro 'local_irq_save'
                   raw_local_irq_save(flags);              \
                   ^
   include/linux/irqflags.h:158:2: note: expanded from macro 
'raw_local_irq_save'
           do {                                            \
           ^
   kernel/events/core.c:812:2: note: Assuming the condition is false
           local_irq_save(flags);
           ^
   include/linux/irqflags.h:203:7: note: expanded from macro 'local_irq_save'
                   if (!raw_irqs_disabled_flags(flags))    \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/events/core.c:812:2: note: Taking false branch
           local_irq_save(flags);
           ^
   include/linux/irqflags.h:203:3: note: expanded from macro 'local_irq_save'
                   if (!raw_irqs_disabled_flags(flags))    \
                   ^
   kernel/events/core.c:812:2: note: Loop condition is false.  Exiting loop
           local_irq_save(flags);
           ^
   include/linux/irqflags.h:201:2: note: expanded from macro 'local_irq_save'
           do {                                            \
           ^
   kernel/events/core.c:814:9: note: Loop condition is false.  Exiting loop
           list = this_cpu_ptr(&cgrp_cpuctx_list);
                  ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)
                                   ^
   include/linux/percpu-defs.h:264:26: note: expanded from macro 'raw_cpu_ptr'
   #define raw_cpu_ptr(ptr)        per_cpu_ptr(ptr, 0)
                                   ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 
'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro 
'__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   kernel/events/core.c:815:2: note: Left side of '&&' is false
           list_for_each_entry(cpuctx, list, cgrp_cpuctx_entry) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:853:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   kernel/events/core.c:815:2: note: Taking false branch
           list_for_each_entry(cpuctx, list, cgrp_cpuctx_entry) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:323:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:311:2: note: expanded from macro 
'_compiletime_assert'

vim +30 kernel/bpf/bpf_struct_ops.c

85d33df357b6346 Martin KaFai Lau 2020-01-08  29  
85d33df357b6346 Martin KaFai Lau 2020-01-08 @30  struct bpf_struct_ops_map {
85d33df357b6346 Martin KaFai Lau 2020-01-08  31         struct bpf_map map;
85d33df357b6346 Martin KaFai Lau 2020-01-08  32         const struct 
bpf_struct_ops *st_ops;
85d33df357b6346 Martin KaFai Lau 2020-01-08  33         /* protect map_update */
85d33df357b6346 Martin KaFai Lau 2020-01-08  34         struct mutex lock;
85d33df357b6346 Martin KaFai Lau 2020-01-08  35         /* progs has all the 
bpf_prog that is populated
85d33df357b6346 Martin KaFai Lau 2020-01-08  36          * to the func ptr of 
the kernel's struct
85d33df357b6346 Martin KaFai Lau 2020-01-08  37          * (in kvalue.data).
85d33df357b6346 Martin KaFai Lau 2020-01-08  38          */
85d33df357b6346 Martin KaFai Lau 2020-01-08  39         struct bpf_prog **progs;
85d33df357b6346 Martin KaFai Lau 2020-01-08  40         /* image is a page that 
has all the trampolines
85d33df357b6346 Martin KaFai Lau 2020-01-08  41          * that stores the func 
args before calling the bpf_prog.
85d33df357b6346 Martin KaFai Lau 2020-01-08  42          * A PAGE_SIZE "image" 
is enough to store all trampoline for
85d33df357b6346 Martin KaFai Lau 2020-01-08  43          * "progs[]".
85d33df357b6346 Martin KaFai Lau 2020-01-08  44          */
85d33df357b6346 Martin KaFai Lau 2020-01-08  45         void *image;
85d33df357b6346 Martin KaFai Lau 2020-01-08  46         /* uvalue->data stores 
the kernel struct
85d33df357b6346 Martin KaFai Lau 2020-01-08  47          * (e.g. 
tcp_congestion_ops) that is more useful
85d33df357b6346 Martin KaFai Lau 2020-01-08  48          * to userspace than 
the kvalue.  For example,
85d33df357b6346 Martin KaFai Lau 2020-01-08  49          * the bpf_prog's id is 
stored instead of the kernel
85d33df357b6346 Martin KaFai Lau 2020-01-08  50          * address of a func 
ptr.
85d33df357b6346 Martin KaFai Lau 2020-01-08  51          */
85d33df357b6346 Martin KaFai Lau 2020-01-08  52         struct 
bpf_struct_ops_value *uvalue;
85d33df357b6346 Martin KaFai Lau 2020-01-08  53         /* kvalue.data stores 
the actual kernel's struct
85d33df357b6346 Martin KaFai Lau 2020-01-08  54          * (e.g. 
tcp_congestion_ops) that will be
85d33df357b6346 Martin KaFai Lau 2020-01-08  55          * registered to the 
kernel subsystem.
85d33df357b6346 Martin KaFai Lau 2020-01-08  56          */
85d33df357b6346 Martin KaFai Lau 2020-01-08  57         struct 
bpf_struct_ops_value kvalue;
85d33df357b6346 Martin KaFai Lau 2020-01-08  58  };
85d33df357b6346 Martin KaFai Lau 2020-01-08  59  

:::::: The code at line 30 was first introduced by commit
:::::: 85d33df357b634649ddbe0a20fd2d0fc5732c3cb bpf: Introduce 
BPF_MAP_TYPE_STRUCT_OPS

:::::: TO: Martin KaFai Lau <[email protected]>
:::::: CC: Alexei Starovoitov <[email protected]>

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