CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Jiang Wang <[email protected]>
TO: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: Jakub Kicinski <[email protected]>
CC: John Fastabend <[email protected]>
CC: Daniel Borkmann <[email protected]>
CC: Jakub Sitnicki <[email protected]>
CC: Lorenz Bauer <[email protected]>

Hi Jiang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    
https://github.com/0day-ci/linux/commits/Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: x86_64-randconfig-c001-20210727 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
c658b472f3e61e1818e1909bf02f3d65470018a5)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/607ed02e3232aa57995e87230faad770b810a64a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Jiang-Wang/sockmap-add-sockmap-support-for-unix-stream-socket/20210727-081531
        git checkout 607ed02e3232aa57995e87230faad770b810a64a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
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 >>)
                       ^~~~
   net/unix/af_unix.c:1251:34: warning: Dereference of null pointer 
[clang-analyzer-core.NullDereference]
                   sk->sk_state = other->sk_state = TCP_ESTABLISHED;
                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:6: note: Assuming the condition is false
           if (alen < offsetofend(struct sockaddr, sa_family))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1189:2: note: Taking false branch
           if (alen < offsetofend(struct sockaddr, sa_family))
           ^
   net/unix/af_unix.c:1192:6: note: Assuming field 'sa_family' is equal to 
AF_UNSPEC
           if (addr->sa_family != AF_UNSPEC) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1192:2: note: Taking false branch
           if (addr->sa_family != AF_UNSPEC) {
           ^
   net/unix/af_unix.c:1228:3: note: Null pointer value stored to 'other'
                   other = NULL;
                   ^~~~~~~~~~~~
   net/unix/af_unix.c:1235:6: note: Assuming field 'peer' is null
           if (unix_peer(sk)) {
               ^
   net/unix/af_unix.c:180:23: note: expanded from macro 'unix_peer'
   #define unix_peer(sk) (unix_sk(sk)->peer)
                         ^~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1235:2: note: Taking false branch
           if (unix_peer(sk)) {
           ^
   net/unix/af_unix.c:1247:3: note: Calling 'unix_state_double_unlock'
                   unix_state_double_unlock(sk, other);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1170:15: note: 'sk1' is not equal to 'sk2'
           if (unlikely(sk1 == sk2) || !sk2) {
                        ^
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   net/unix/af_unix.c:1170:15: note: 'sk1' is not equal to 'sk2'
           if (unlikely(sk1 == sk2) || !sk2) {
                        ^
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   net/unix/af_unix.c:1170:6: note: Left side of '||' is false
           if (unlikely(sk1 == sk2) || !sk2) {
               ^
   include/linux/compiler.h:48:23: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                           ^
   net/unix/af_unix.c:1170:31: note: 'sk2' is null
           if (unlikely(sk1 == sk2) || !sk2) {
                                        ^~~
   net/unix/af_unix.c:1170:2: note: Taking true branch
           if (unlikely(sk1 == sk2) || !sk2) {
           ^
   net/unix/af_unix.c:1171:3: note: Calling 'spin_unlock'
                   unix_state_unlock(sk1);
                   ^
   include/net/af_unix.h:51:30: note: expanded from macro 'unix_state_unlock'
   #define unix_state_unlock(s)    spin_unlock(&unix_sk(s)->lock)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/spinlock.h:394:2: note: Value assigned to field 'peer', which 
participates in a condition later
           raw_spin_unlock(&lock->rlock);
           ^
   include/linux/spinlock.h:284:32: note: expanded from macro 'raw_spin_unlock'
   #define raw_spin_unlock(lock)           _raw_spin_unlock(lock)
                                           ^~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1171:3: note: Returning from 'spin_unlock'
                   unix_state_unlock(sk1);
                   ^
   include/net/af_unix.h:51:30: note: expanded from macro 'unix_state_unlock'
   #define unix_state_unlock(s)    spin_unlock(&unix_sk(s)->lock)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1247:3: note: Returning from 'unix_state_double_unlock'
                   unix_state_double_unlock(sk, other);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1250:6: note: Assuming field 'peer' is non-null
           if (unix_peer(sk))
               ^
   net/unix/af_unix.c:180:23: note: expanded from macro 'unix_peer'
   #define unix_peer(sk) (unix_sk(sk)->peer)
                         ^~~~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1250:2: note: Taking true branch
           if (unix_peer(sk))
           ^
   net/unix/af_unix.c:1251:34: note: Dereference of null pointer
                   sk->sk_state = other->sk_state = TCP_ESTABLISHED;
                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
   net/unix/af_unix.c:1558:3: warning: Value stored to 'err' is never read 
[clang-analyzer-deadcode.DeadStores]
                   err = 0;
                   ^     ~
   net/unix/af_unix.c:1558:3: note: Value stored to 'err' is never read
                   err = 0;
                   ^     ~
>> net/unix/af_unix.c:2590:15: warning: Value stored to 'sk' during its 
>> initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct sock *sk = sock->sk;
                        ^~   ~~~~~~~~
   net/unix/af_unix.c:2590:15: note: Value stored to 'sk' during its 
initialization is never read
           struct sock *sk = sock->sk;
                        ^~   ~~~~~~~~
   Suppressed 12 warnings (11 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.
   net/atm/common.c:238:2: warning: Assigned value is garbage or undefined 
[clang-analyzer-core.uninitialized.Assign]
           skb_queue_walk_safe(&queue, skb, tmp) {
           ^
   include/linux/skbuff.h:3537:33: note: expanded from macro 
'skb_queue_walk_safe'
                   for (skb = (queue)->next, tmp = skb->next;                   
   \
                                                 ^ ~~~~~~~~~
   net/atm/common.c:231:2: note: Calling '__skb_queue_head_init'
           __skb_queue_head_init(&queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:231:2: note: Returning from '__skb_queue_head_init'
           __skb_queue_head_init(&queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:234:2: note: Loop condition is false.  Exiting loop
           spin_lock_irqsave(&rq->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 {                                            \
           ^
   net/atm/common.c:234:2: note: Loop condition is false.  Exiting loop
           spin_lock_irqsave(&rq->lock, flags);
           ^
   include/linux/spinlock.h:382:43: note: expanded from macro 
'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   net/atm/common.c:235:2: note: Calling 'skb_queue_splice_init'
           skb_queue_splice_init(rq, &queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:1979:6: note: Assuming the condition is false
           if (!skb_queue_empty(list)) {
               ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:1979:2: note: Taking false branch
           if (!skb_queue_empty(list)) {
           ^
   net/atm/common.c:235:2: note: Returning from 'skb_queue_splice_init'
           skb_queue_splice_init(rq, &queue);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/atm/common.c:238:2: note: Assigned value is garbage or undefined
           skb_queue_walk_safe(&queue, skb, tmp) {
           ^
   include/linux/skbuff.h:3537:33: note: expanded from macro 
'skb_queue_walk_safe'
                   for (skb = (queue)->next, tmp = skb->next;                   
   \
                                                 ^ ~~~~~~~~~
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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/thunderbolt/switch.c:498:36: warning: Value stored to 'regs' during 
its initialization is never read [clang-analyzer-deadcode.DeadStores]
           const struct tb_regs_port_header *regs = &port->config;
                                             ^~~~   ~~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:498:36: note: Value stored to 'regs' during its 
initialization is never read
           const struct tb_regs_port_header *regs = &port->config;
                                             ^~~~   ~~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:1408:38: warning: Value stored to 'regs' during 
its initialization is never read [clang-analyzer-deadcode.DeadStores]
           const struct tb_regs_switch_header *regs = &sw->config;
                                               ^~~~   ~~~~~~~~~~~
   drivers/thunderbolt/switch.c:1408:38: note: Value stored to 'regs' during 
its initialization is never read
           const struct tb_regs_switch_header *regs = &sw->config;
                                               ^~~~   ~~~~~~~~~~~
   drivers/thunderbolt/switch.c:2268:13: warning: Value stored to 'tb' during 
its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct tb *tb = sw->tb;
                      ^~   ~~~~~~
   drivers/thunderbolt/switch.c:2268:13: note: Value stored to 'tb' during its 
initialization is never read
           struct tb *tb = sw->tb;
                      ^~   ~~~~~~
   drivers/thunderbolt/switch.c:2272:2: warning: Value stored to 'route' is 
never read [clang-analyzer-deadcode.DeadStores]
           route = tb_route(sw);
           ^       ~~~~~~~~~~~~
   drivers/thunderbolt/switch.c:2272:2: note: Value stored to 'route' is never 
read
           route = tb_route(sw);
           ^       ~~~~~~~~~~~~
   Suppressed 5 warnings (5 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.

vim +/sk +2590 net/unix/af_unix.c

607ed02e3232aa Jiang Wang           2021-07-27  2578  
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2579  static int 
unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2580                           
size_t size, int flags)
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2581  {
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2582    struct 
unix_stream_read_state state = {
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2583            .recv_actor = 
unix_stream_read_actor,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2584            .socket = sock,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2585            .msg = msg,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2586            .size = size,
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2587            .flags = flags
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2588    };
2b514574f7e88c Hannes Frederic Sowa 2015-05-21  2589  
607ed02e3232aa Jiang Wang           2021-07-27 @2590    struct sock *sk = 
sock->sk;
607ed02e3232aa Jiang Wang           2021-07-27  2591  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to