Message ID | 20201210215331.141767-1-toke@redhat.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v2] inet_ecn: Use csum16_add() helper for IP_ECN_set_* helpers | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | fail | Errors and warnings before: 2271 this patch: 2385 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 42 lines checked |
netdev/build_allmodconfig_warn | fail | Errors and warnings before: 2148 this patch: 2277 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
Hi "Toke, I love your patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Toke-H-iland-J-rgensen/inet_ecn-Use-csum16_add-helper-for-IP_ECN_set_-helpers/20201211-071305 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 51e13685bd93654e0e9b2559c8e103d6545ddf95 config: i386-randconfig-s001-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-179-ga00755aa-dirty # https://github.com/0day-ci/linux/commit/30ca3d0f48b3d72f9ca0a3509eb63956484d02ad git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Toke-H-iland-J-rgensen/inet_ecn-Use-csum16_add-helper-for-IP_ECN_set_-helpers/20201211-071305 git checkout 30ca3d0f48b3d72f9ca0a3509eb63956484d02ad # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> "sparse warnings: (new ones prefixed by >>)" net/sched/sch_fq.c: note: in included file (through include/net/tcp.h): include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_sfq.c: note: in included file (through include/net/red.h): include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_sfb.c: note: in included file: include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_fq_codel.c: note: in included file (through include/net/codel.h): include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_choke.c: note: in included file: include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_codel.c: note: in included file (through include/net/codel.h): include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_red.c: note: in included file: include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int -- net/sched/sch_netem.c: note: in included file: include/net/inet_ecn.h:97:21: sparse: sparse: restricted __be16 degrades to integer include/net/inet_ecn.h:97:37: sparse: sparse: restricted __be16 degrades to integer >> include/net/inet_ecn.h:97:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] check_add @@ got int @@ include/net/inet_ecn.h:97:19: sparse: expected restricted __be16 [usertype] check_add include/net/inet_ecn.h:97:19: sparse: got int vim +97 include/net/inet_ecn.h 67 68 #define IP6_ECN_flow_init(label) do { \ 69 (label) &= ~htonl(INET_ECN_MASK << 20); \ 70 } while (0) 71 72 #define IP6_ECN_flow_xmit(sk, label) do { \ 73 if (INET_ECN_is_capable(inet6_sk(sk)->tclass)) \ 74 (label) |= htonl(INET_ECN_ECT_0 << 20); \ 75 } while (0) 76 77 static inline int IP_ECN_set_ce(struct iphdr *iph) 78 { 79 u32 ecn = (iph->tos + 1) & INET_ECN_MASK; 80 __be16 check_add; 81 82 /* 83 * After the last operation we have (in binary): 84 * INET_ECN_NOT_ECT => 01 85 * INET_ECN_ECT_1 => 10 86 * INET_ECN_ECT_0 => 11 87 * INET_ECN_CE => 00 88 */ 89 if (!(ecn & 2)) 90 return !ecn; 91 92 /* 93 * The following gives us: 94 * INET_ECN_ECT_1 => check += htons(0xFFFD) 95 * INET_ECN_ECT_0 => check += htons(0xFFFE) 96 */ > 97 check_add = htons(0xFFFB) + htons(ecn); 98 99 iph->check = csum16_add(iph->check, check_add); 100 iph->tos |= INET_ECN_CE; 101 return 1; 102 } 103 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 563457fec557..d916a458aceb 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -8,6 +8,7 @@ #include <net/inet_sock.h> #include <net/dsfield.h> +#include <net/checksum.h> enum { INET_ECN_NOT_ECT = 0, @@ -75,8 +76,8 @@ static inline void INET_ECN_dontxmit(struct sock *sk) static inline int IP_ECN_set_ce(struct iphdr *iph) { - u32 check = (__force u32)iph->check; u32 ecn = (iph->tos + 1) & INET_ECN_MASK; + __be16 check_add; /* * After the last operation we have (in binary): @@ -93,23 +94,19 @@ static inline int IP_ECN_set_ce(struct iphdr *iph) * INET_ECN_ECT_1 => check += htons(0xFFFD) * INET_ECN_ECT_0 => check += htons(0xFFFE) */ - check += (__force u16)htons(0xFFFB) + (__force u16)htons(ecn); + check_add = htons(0xFFFB) + htons(ecn); - iph->check = (__force __sum16)(check + (check>=0xFFFF)); + iph->check = csum16_add(iph->check, check_add); iph->tos |= INET_ECN_CE; return 1; } static inline int IP_ECN_set_ect1(struct iphdr *iph) { - u32 check = (__force u32)iph->check; - if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0) return 0; - check += (__force u16)htons(0x1); - - iph->check = (__force __sum16)(check + (check>=0xFFFF)); + iph->check = csum16_add(iph->check, htons(0x1)); iph->tos ^= INET_ECN_MASK; return 1; }