CC: [email protected] CC: [email protected] TO: Chris Down <[email protected]> CC: Petr Mladek <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git for-5.15-printk-index head: 894d9c2e994946ffbd5401c2391f0a4ca6243a08 commit: 337015573718b161891a3473d25f59273f2e626b [4/8] printk: Userspace format indexing support :::::: branch date: 2 days ago :::::: commit date: 6 days ago config: x86_64-randconfig-c001-20210725 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 3f2c1e99e44d028d5e9dd685f3c568f2661f2f68) 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://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b git remote add printk https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git git fetch --no-tags printk for-5.15-printk-index git checkout 337015573718b161891a3473d25f59273f2e626b # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross clang-analyzer ARCH=x86_64 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 >>) drivers/nvmem/core.c:1633:6: note: Returning from 'IS_ERR' if (IS_ERR(buf)) ^~~~~~~~~~~ drivers/nvmem/core.c:1633:2: note: Taking false branch if (IS_ERR(buf)) ^ drivers/nvmem/core.c:1640:6: note: Assuming 'nbits' is 0 if (nbits) ^~~~~ drivers/nvmem/core.c:1640:2: note: Taking false branch if (nbits) ^ drivers/nvmem/core.c:1643:11: note: The left operand of '>' is a garbage value if (*len > max_len) { ~~~~ ^ 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. 5 warnings generated. Suppressed 5 warnings (4 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. 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. 4 warnings generated. Suppressed 4 warnings (4 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. 6 warnings generated. Suppressed 6 warnings (6 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. 4 warnings generated. Suppressed 4 warnings (4 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 6 warnings generated. Suppressed 6 warnings (6 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. 8 warnings generated. 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. 12 warnings generated. net/sched/sch_htb.c:94:8: warning: Excessive padding in 'struct htb_class' (64 padding bytes, where 0 is optimal). Optimal fields order: drops, prio, buffer, cbuffer, mbuffer, filter_list, block, parent, rate_est, tokens, ctokens, t_c, pq_key, rate, ceil, bstats, bstats_bias, common, pq_node, , node, quantum, filter_cnt, level, children, prio_activity, cmode, overlimits, xstats, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] struct htb_class { ~~~~~~~^~~~~~~~~~~ net/sched/sch_htb.c:94:8: note: Excessive padding in 'struct htb_class' (64 padding bytes, where 0 is optimal). Optimal fields order: drops, prio, buffer, cbuffer, mbuffer, filter_list, block, parent, rate_est, tokens, ctokens, t_c, pq_key, rate, ceil, bstats, bstats_bias, common, pq_node, , node, quantum, filter_cnt, level, children, prio_activity, cmode, overlimits, xstats, consider reordering the fields or adding explicit padding members struct htb_class { ~~~~~~~^~~~~~~~~~~ >> net/sched/sch_htb.c:834:11: warning: Access to field 'rb_left' results in a >> dereference of a null pointer [clang-analyzer-core.NullDereference] while ((*sp->pptr)->rb_left) ^ net/sched/sch_htb.c:940:6: note: 'skb' is equal to NULL if (skb != NULL) { ^~~ net/sched/sch_htb.c:940:2: note: Taking false branch if (skb != NULL) { ^ net/sched/sch_htb.c:948:6: note: Assuming field 'qlen' is not equal to 0 if (!sch->q.qlen) ^~~~~~~~~~~~ net/sched/sch_htb.c:948:2: note: Taking false branch if (!sch->q.qlen) ^ net/sched/sch_htb.c:955:2: note: Loop condition is true. Entering loop body for (level = 0; level < TC_HTB_MAXDEPTH; level++) { ^ net/sched/sch_htb.c:960:7: note: Assuming 'event' is > field 'now' if (q->now >= event) { ^~~~~~~~~~~~~~~ net/sched/sch_htb.c:960:3: note: Taking false branch if (q->now >= event) { ^ net/sched/sch_htb.c:967:7: note: Assuming 'next_event' is <= 'event' if (next_event > event) ^~~~~~~~~~~~~~~~~~ net/sched/sch_htb.c:967:3: note: Taking false branch if (next_event > event) ^ net/sched/sch_htb.c:971:10: note: Assuming the condition is true while (m != (int)(-1)) { ^~~~~~~~~~~~~~ net/sched/sch_htb.c:971:3: note: Loop condition is true. Entering loop body while (m != (int)(-1)) { ^ net/sched/sch_htb.c:976:4: note: Taking false branch if (likely(skb != NULL)) ^ net/sched/sch_htb.c:971:10: note: Assuming the condition is true while (m != (int)(-1)) { ^~~~~~~~~~~~~~ net/sched/sch_htb.c:971:3: note: Loop condition is true. Entering loop body while (m != (int)(-1)) { ^ net/sched/sch_htb.c:975:10: note: Calling 'htb_dequeue_tree' skb = htb_dequeue_tree(q, prio, level); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/sched/sch_htb.c:873:15: note: Calling 'htb_lookup_leaf' start = cl = htb_lookup_leaf(hprio, prio); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/sched/sch_htb.c:816:2: note: Assuming the condition is false BUG_ON(!hprio->row.rb_node); ^ include/asm-generic/bug.h:65:36: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:78:22: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~ net/sched/sch_htb.c:816:2: note: Taking false branch BUG_ON(!hprio->row.rb_node); ^ include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ net/sched/sch_htb.c:816:2: note: Loop condition is false. Exiting loop BUG_ON(!hprio->row.rb_node); ^ include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ net/sched/sch_htb.c:821:2: note: Loop condition is true. Entering loop body for (i = 0; i < 65535; i++) { ^ net/sched/sch_htb.c:822:7: note: Assuming the condition is false if (!*sp->pptr && *sp->pid) { ^~~~~~~~~~ net/sched/sch_htb.c:822:18: note: Left side of '&&' is false if (!*sp->pptr && *sp->pid) { ^ net/sched/sch_htb.c:832:7: note: Assuming the condition is false if (!*sp->pptr) { /* we are at right end; rewind & go up */ ^~~~~~~~~~ net/sched/sch_htb.c:832:3: note: Taking false branch if (!*sp->pptr) { /* we are at right end; rewind & go up */ ^ net/sched/sch_htb.c:848:9: note: Left side of '&&' is false cl = rb_entry(*sp->pptr, struct htb_class, node[prio]); ^ include/linux/rbtree.h:38:37: note: expanded from macro 'rb_entry' #define rb_entry(ptr, type, member) container_of(ptr, type, member) ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ net/sched/sch_htb.c:848:9: note: Taking false branch cl = rb_entry(*sp->pptr, struct htb_class, node[prio]); ^ include/linux/rbtree.h:38:37: note: expanded from macro 'rb_entry' #define rb_entry(ptr, type, member) container_of(ptr, type, member) -- typeof(divisor) __d = divisor; \ ^~~~~~~~~~~~~~~~~~~ net/ipv4/nexthop.c:1648:17: note: Left side of '||' is false upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:89:3: note: expanded from macro 'DIV_ROUND_CLOSEST' (((typeof(x))-1) > 0 || \ ^ net/ipv4/nexthop.c:1648:17: note: Left side of '||' is false upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:89:3: note: expanded from macro 'DIV_ROUND_CLOSEST' (((typeof(x))-1) > 0 || \ ^ net/ipv4/nexthop.c:1648:17: note: Assuming '__x' is <= 0 upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:91:5: note: expanded from macro 'DIV_ROUND_CLOSEST' (((__x) > 0) == ((__d) > 0))) ? \ ^~~~~~~~~ net/ipv4/nexthop.c:1648:17: note: Assuming '__d' is <= 0 upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:91:20: note: expanded from macro 'DIV_ROUND_CLOSEST' (((__x) > 0) == ((__d) > 0))) ? \ ^~~~~~~~~ net/ipv4/nexthop.c:1648:17: note: '?' condition is true upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:89:2: note: expanded from macro 'DIV_ROUND_CLOSEST' (((typeof(x))-1) > 0 || \ ^ net/ipv4/nexthop.c:1648:17: note: Division by zero upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, ^ include/linux/math.h:92:26: note: expanded from macro 'DIV_ROUND_CLOSEST' (((__x) + ((__d) / 2)) / (__d)) : \ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ Suppressed 9 warnings (9 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. 12 warnings generated. fs/cifs/ioctl.c:335:4: warning: Value stored to 'caps' is never read [clang-analyzer-deadcode.DeadStores] caps = le64_to_cpu(tcon->fsUnixInfo.Capability); ^ fs/cifs/ioctl.c:335:4: note: Value stored to 'caps' is never read fs/cifs/ioctl.c:362:4: warning: Value stored to 'caps' is never read [clang-analyzer-deadcode.DeadStores] caps = le64_to_cpu(tcon->fsUnixInfo.Capability); ^ fs/cifs/ioctl.c:362:4: note: Value stored to 'caps' is never read Suppressed 10 warnings (9 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. fs/cifs/sess.c:455:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(bcc_ptr, "Linux version "); ^~~~~~ fs/cifs/sess.c:455:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(bcc_ptr, "Linux version "); ^~~~~~ fs/cifs/sess.c:457:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(bcc_ptr, init_utsname()->release); ^~~~~~ fs/cifs/sess.c:457:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(bcc_ptr, init_utsname()->release); ^~~~~~ fs/cifs/sess.c:460:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); ^~~~~~ fs/cifs/sess.c:460:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); ^~~~~~ Suppressed 9 warnings (9 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. Suppressed 9 warnings (9 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. Suppressed 9 warnings (9 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. Suppressed 9 warnings (9 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. 13 warnings generated. fs/cifs/smb2ops.c:4164:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcat(message, "R"); ^~~~~~ fs/cifs/smb2ops.c:4164:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 strcat(message, "R"); ^~~~~~ fs/cifs/smb2ops.c:4168:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcat(message, "H"); ^~~~~~ fs/cifs/smb2ops.c:4168:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 strcat(message, "H"); ^~~~~~ fs/cifs/smb2ops.c:4172:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcat(message, "W"); ^~~~~~ fs/cifs/smb2ops.c:4172:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 strcat(message, "W"); ^~~~~~ >> fs/cifs/smb2ops.c:5115:6: warning: Access to field 'NextCommand' results in >> a dereference of a null pointer (loaded from variable 'shdr') >> [clang-analyzer-core.NullDereference] if (shdr->NextCommand) { ^~~~ fs/cifs/smb2ops.c:5089:2: note: 'next_buffer' initialized to a null pointer value char *next_buffer = NULL; ^~~~~~~~~~~~~~~~~ fs/cifs/smb2ops.c:5094:6: note: Assuming 'pdu_length' is <= MAX_CIFS_SMALL_BUFFER_SIZE if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/cifs/smb2ops.c:5094:2: note: Taking false branch if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE) { ^ fs/cifs/smb2ops.c:5103:6: note: Assuming 'length' is >= 0 if (length < 0) ^~~~~~~~~~ fs/cifs/smb2ops.c:5103:2: note: Taking false branch if (length < 0) ^ fs/cifs/smb2ops.c:5108:11: note: Calling 'decrypt_raw_data' length = decrypt_raw_data(server, buf, buf_size, NULL, 0, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/cifs/smb2ops.c:4670:19: note: '?' condition is false rqst.rq_tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE; ^ fs/cifs/smb2ops.c:4672:7: note: Value assigned to field 'large_buf', which participates in a condition later rc = crypt_message(server, 1, &rqst, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/cifs/smb2ops.c:4673:2: note: Taking false branch cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:76:2: note: expanded from macro 'cifs_dbg' if ((type) & ONCE) \ ^ fs/cifs/smb2ops.c:4673:2: note: Left side of '&&' is true cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^ fs/cifs/cifs_debug.h:64:6: note: expanded from macro 'cifs_dbg_func' if ((type) & FYI && cifsFYI & CIFS_INFO) { \ ^ fs/cifs/smb2ops.c:4673:2: note: Assuming the condition is false cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/cifs/cifs_debug.h:64:22: note: expanded from macro 'cifs_dbg_func' if ((type) & FYI && cifsFYI & CIFS_INFO) { \ ^~~~~~~~~~~~~~~~~~~ fs/cifs/smb2ops.c:4673:2: note: Taking false branch cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^ fs/cifs/cifs_debug.h:64:2: note: expanded from macro 'cifs_dbg_func' if ((type) & FYI && cifsFYI & CIFS_INFO) { \ ^ fs/cifs/smb2ops.c:4673:2: note: Taking false branch cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^ fs/cifs/cifs_debug.h:67:9: note: expanded from macro 'cifs_dbg_func' } else if ((type) & VFS) { \ ^ fs/cifs/smb2ops.c:4673:2: note: Left side of '&&' is false cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^ fs/cifs/cifs_debug.h:69:28: note: expanded from macro 'cifs_dbg_func' } else if ((type) & NOISY && (NOISY != 0)) { \ ^ fs/cifs/smb2ops.c:4673:2: note: Loop condition is false. Exiting loop cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:79:3: note: expanded from macro 'cifs_dbg' cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \ ^ fs/cifs/cifs_debug.h:62:52: note: expanded from macro 'cifs_dbg_func' #define cifs_dbg_func(ratefunc, type, fmt, ...) \ ^ fs/cifs/smb2ops.c:4673:2: note: Loop condition is false. Exiting loop cifs_dbg(FYI, "Decrypt message returned %d\n", rc); ^ fs/cifs/cifs_debug.h:74:38: note: expanded from macro 'cifs_dbg' #define cifs_dbg(type, fmt, ...) \ ^ fs/cifs/smb2ops.c:4675:6: note: Assuming 'rc' is 0, which participates in a condition later if (rc) ^~ fs/cifs/smb2ops.c:4675:2: note: Taking false branch if (rc) ^ fs/cifs/smb2ops.c:4680:7: note: 'is_offloaded' is false if (!is_offloaded) vim +/rb_left +834 net/sched/sch_htb.c ^1da177e4c3f41 Linus Torvalds 2005-04-16 799 ^1da177e4c3f41 Linus Torvalds 2005-04-16 800 /** ^1da177e4c3f41 Linus Torvalds 2005-04-16 801 * htb_lookup_leaf - returns next leaf class in DRR order 9977d6f56bacc9 Yu Kuai 2021-06-05 802 * @hprio: the current one 9977d6f56bacc9 Yu Kuai 2021-06-05 803 * @prio: which prio in class ^1da177e4c3f41 Linus Torvalds 2005-04-16 804 * ^1da177e4c3f41 Linus Torvalds 2005-04-16 805 * Find leaf where current feed pointers points to. ^1da177e4c3f41 Linus Torvalds 2005-04-16 806 */ c9364636dcb01a Eric Dumazet 2013-06-15 807 static struct htb_class *htb_lookup_leaf(struct htb_prio *hprio, const int prio) ^1da177e4c3f41 Linus Torvalds 2005-04-16 808 { ^1da177e4c3f41 Linus Torvalds 2005-04-16 809 int i; ^1da177e4c3f41 Linus Torvalds 2005-04-16 810 struct { ^1da177e4c3f41 Linus Torvalds 2005-04-16 811 struct rb_node *root; ^1da177e4c3f41 Linus Torvalds 2005-04-16 812 struct rb_node **pptr; ^1da177e4c3f41 Linus Torvalds 2005-04-16 813 u32 *pid; ^1da177e4c3f41 Linus Torvalds 2005-04-16 814 } stk[TC_HTB_MAXDEPTH], *sp = stk; ^1da177e4c3f41 Linus Torvalds 2005-04-16 815 c9364636dcb01a Eric Dumazet 2013-06-15 816 BUG_ON(!hprio->row.rb_node); c9364636dcb01a Eric Dumazet 2013-06-15 817 sp->root = hprio->row.rb_node; c9364636dcb01a Eric Dumazet 2013-06-15 818 sp->pptr = &hprio->ptr; c9364636dcb01a Eric Dumazet 2013-06-15 819 sp->pid = &hprio->last_ptr_id; ^1da177e4c3f41 Linus Torvalds 2005-04-16 820 ^1da177e4c3f41 Linus Torvalds 2005-04-16 821 for (i = 0; i < 65535; i++) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 822 if (!*sp->pptr && *sp->pid) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 823 /* ptr was invalidated but id is valid - try to recover cc7ec456f82da7 Eric Dumazet 2011-01-19 824 * the original or next ptr cc7ec456f82da7 Eric Dumazet 2011-01-19 825 */ 87990467d387f9 Stephen Hemminger 2006-08-10 826 *sp->pptr = 87990467d387f9 Stephen Hemminger 2006-08-10 827 htb_id_find_next_upper(prio, sp->root, *sp->pid); ^1da177e4c3f41 Linus Torvalds 2005-04-16 828 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 829 *sp->pid = 0; /* ptr is valid now so that remove this hint as it cc7ec456f82da7 Eric Dumazet 2011-01-19 830 * can become out of date quickly cc7ec456f82da7 Eric Dumazet 2011-01-19 831 */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 832 if (!*sp->pptr) { /* we are at right end; rewind & go up */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 833 *sp->pptr = sp->root; ^1da177e4c3f41 Linus Torvalds 2005-04-16 @834 while ((*sp->pptr)->rb_left) ^1da177e4c3f41 Linus Torvalds 2005-04-16 835 *sp->pptr = (*sp->pptr)->rb_left; ^1da177e4c3f41 Linus Torvalds 2005-04-16 836 if (sp > stk) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 837 sp--; 512bb43eb5422e Jarek Poplawski 2008-12-09 838 if (!*sp->pptr) { 512bb43eb5422e Jarek Poplawski 2008-12-09 839 WARN_ON(1); 87990467d387f9 Stephen Hemminger 2006-08-10 840 return NULL; 512bb43eb5422e Jarek Poplawski 2008-12-09 841 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 842 htb_next_rb_node(sp->pptr); ^1da177e4c3f41 Linus Torvalds 2005-04-16 843 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 844 } else { ^1da177e4c3f41 Linus Torvalds 2005-04-16 845 struct htb_class *cl; c9364636dcb01a Eric Dumazet 2013-06-15 846 struct htb_prio *clp; c9364636dcb01a Eric Dumazet 2013-06-15 847 ^1da177e4c3f41 Linus Torvalds 2005-04-16 848 cl = rb_entry(*sp->pptr, struct htb_class, node[prio]); ^1da177e4c3f41 Linus Torvalds 2005-04-16 849 if (!cl->level) ^1da177e4c3f41 Linus Torvalds 2005-04-16 850 return cl; 11957be20ff68d Cong Wang 2018-09-07 851 clp = &cl->inner.clprio[prio]; c9364636dcb01a Eric Dumazet 2013-06-15 852 (++sp)->root = clp->feed.rb_node; c9364636dcb01a Eric Dumazet 2013-06-15 853 sp->pptr = &clp->ptr; c9364636dcb01a Eric Dumazet 2013-06-15 854 sp->pid = &clp->last_ptr_id; ^1da177e4c3f41 Linus Torvalds 2005-04-16 855 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 856 } 547b792cac0a03 Ilpo Järvinen 2008-07-25 857 WARN_ON(1); ^1da177e4c3f41 Linus Torvalds 2005-04-16 858 return NULL; ^1da177e4c3f41 Linus Torvalds 2005-04-16 859 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 860 :::::: The code at line 834 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
