CC: [email protected]
CC: [email protected]
BCC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Eric Dumazet <[email protected]>

Hi Eric,

I love your patch! Perhaps something to improve:

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

url:    
https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/tcp-add-accessors-to-read-set-tp-snd_cwnd/20220406-161903
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
89695196f0ba78a17453f9616355f2ca6b293402
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-c001 
(https://download.01.org/0day-ci/archive/20220408/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
c4a1b07d0979e7ff20d7d541af666d822d66b566)
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
        # 
https://github.com/intel-lab-lkp/linux/commit/a1c4e7b0b591c2203bbd899b37c3ca442559734a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review 
Eric-Dumazet/tcp-add-accessors-to-read-set-tp-snd_cwnd/20220406-161903
        git checkout a1c4e7b0b591c2203bbd899b37c3ca442559734a
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
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 >>)
   sound/soc/soc-dapm.c:1655:2: note: '?' condition is false
           if (power_up)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   sound/soc/soc-dapm.c:1655:6: note: 'power_up' is true
           if (power_up)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/soc/soc-dapm.c:1655:2: note: '?' condition is true
           if (power_up)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/soc/soc-dapm.c:1655:2: note: Taking true branch
           if (power_up)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/soc/soc-dapm.c:1660:2: note: Loop condition is false. Execution 
continues on line 1729
           list_for_each_entry_safe(w, n, list, power_list) {
           ^
   include/linux/list.h:725:2: note: expanded from macro 
'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
           ^
   sound/soc/soc-dapm.c:1729:6: note: Assuming the condition is false
           if (!list_empty(&pending))
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   sound/soc/soc-dapm.c:1729:2: note: '?' condition is false
           if (!list_empty(&pending))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   sound/soc/soc-dapm.c:1729:6: note: Assuming the condition is true
           if (!list_empty(&pending))
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/soc/soc-dapm.c:1729:2: note: '?' condition is true
           if (!list_empty(&pending))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/soc/soc-dapm.c:1729:2: note: Taking true branch
           if (!list_empty(&pending))
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/soc/soc-dapm.c:1730:3: note: Calling 'dapm_seq_run_coalesced'
                   dapm_seq_run_coalesced(card, &pending);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/soc-dapm.c:1594:6: note: Assigned value is garbage or undefined
           reg = w->reg;
               ^ ~~~~~~
   1 warning generated.
>> net/ipv4/tcp_cong.c:418:32: warning: Division by zero 
>> [clang-analyzer-core.DivideZero]
                   u32 delta = tp->snd_cwnd_cnt / w;
                                                ^
   net/ipv4/tcp_cong.c:438:2: note: '?' condition is false
           if (!tcp_is_cwnd_limited(sk))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   net/ipv4/tcp_cong.c:438:2: note: '?' condition is false
           if (!tcp_is_cwnd_limited(sk))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   net/ipv4/tcp_cong.c:438:2: note: Taking false branch
           if (!tcp_is_cwnd_limited(sk))
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   net/ipv4/tcp_cong.c:442:2: note: '?' condition is false
           if (tcp_in_slow_start(tp)) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   net/ipv4/tcp_cong.c:442:2: note: '?' condition is true
           if (tcp_in_slow_start(tp)) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   net/ipv4/tcp_cong.c:442:2: note: Taking true branch
           if (tcp_in_slow_start(tp)) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   net/ipv4/tcp_cong.c:443:11: note: Calling 'tcp_slow_start'
                   acked = tcp_slow_start(tp, acked);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/tcp_cong.c:396:13: note: Assuming '__UNIQUE_ID___x541' is >= 
'__UNIQUE_ID___y542'
           u32 cwnd = min(tcp_snd_cwnd(tp) + acked, tp->snd_ssthresh);
                      ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^~~~~~~~~~
   net/ipv4/tcp_cong.c:396:13: note: '?' condition is false
           u32 cwnd = min(tcp_snd_cwnd(tp) + acked, tp->snd_ssthresh);
                      ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^
   net/ipv4/tcp_cong.c:399:23: note: Assuming '__UNIQUE_ID___x543' is >= 
'__UNIQUE_ID___y544'
           tcp_snd_cwnd_set(tp, min(cwnd, tp->snd_cwnd_clamp));
                                ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })

vim +418 net/ipv4/tcp_cong.c

40efc6fa179f44 Stephen Hemminger 2006-01-03  404  
814d488c612605 Neal Cardwell     2015-01-28  405  /* In theory this is 
tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w),
814d488c612605 Neal Cardwell     2015-01-28  406   * for every packet that was 
ACKed.
814d488c612605 Neal Cardwell     2015-01-28  407   */
e73ebb0881ea55 Neal Cardwell     2015-01-28  408  void tcp_cong_avoid_ai(struct 
tcp_sock *tp, u32 w, u32 acked)
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  409  {
9949afa42be0b7 Neal Cardwell     2015-03-10  410        /* If credits 
accumulated at a higher w, apply them gently now. */
9949afa42be0b7 Neal Cardwell     2015-03-10  411        if (tp->snd_cwnd_cnt >= 
w) {
9949afa42be0b7 Neal Cardwell     2015-03-10  412                
tp->snd_cwnd_cnt = 0;
a1c4e7b0b591c2 Eric Dumazet      2022-04-05  413                
tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) + 1);
9949afa42be0b7 Neal Cardwell     2015-03-10  414        }
9949afa42be0b7 Neal Cardwell     2015-03-10  415  
e73ebb0881ea55 Neal Cardwell     2015-01-28  416        tp->snd_cwnd_cnt += 
acked;
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  417        if (tp->snd_cwnd_cnt >= 
w) {
814d488c612605 Neal Cardwell     2015-01-28 @418                u32 delta = 
tp->snd_cwnd_cnt / w;
814d488c612605 Neal Cardwell     2015-01-28  419  
814d488c612605 Neal Cardwell     2015-01-28  420                
tp->snd_cwnd_cnt -= delta * w;
a1c4e7b0b591c2 Eric Dumazet      2022-04-05  421                
tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) + delta);
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  422        }
a1c4e7b0b591c2 Eric Dumazet      2022-04-05  423        tcp_snd_cwnd_set(tp, 
min(tcp_snd_cwnd(tp), tp->snd_cwnd_clamp));
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  424  }
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  425  
EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);
758ce5c8d11d6f Ilpo Järvinen     2009-02-28  426  

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