tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes head: be32e0f17dc184e41da2e83e5bf700f3f1c7e93f commit: 7fb6c63025ff14516ce86b5a302d385fd0aab6c0 [179/251] netfilter: ipset: Limit the maximal range of consecutive elements to add/delete config: s390-randconfig-r016-20210803 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=7fb6c63025ff14516ce86b5a302d385fd0aab6c0 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next pending-fixes git checkout 7fb6c63025ff14516ce86b5a302d385fd0aab6c0 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): In file included from net/netfilter/ipset/ip_set_hash_ipportnet.c:8: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:31: In file included from include/linux/dma-mapping.h:10: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) ^ include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ In file included from net/netfilter/ipset/ip_set_hash_ipportnet.c:8: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:31: In file included from include/linux/dma-mapping.h:10: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) ^ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) ^ In file included from net/netfilter/ipset/ip_set_hash_ipportnet.c:8: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:31: In file included from include/linux/dma-mapping.h:10: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ >> net/netfilter/ipset/ip_set_hash_ipportnet.c:249:29: warning: variable 'port_to' is uninitialized when used here [-Wuninitialized] if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE) ^~~~~~~ net/netfilter/ipset/ip_set_hash_ipportnet.c:167:45: note: initialize the variable 'port_to' to silence this warning u32 ip = 0, ip_to = 0, p = 0, port, port_to; ^ = 0 >> net/netfilter/ipset/ip_set_hash_ipportnet.c:249:39: warning: variable 'port' is uninitialized when used here [-Wuninitialized] if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE) ^~~~ net/netfilter/ipset/ip_set_hash_ipportnet.c:167:36: note: initialize the variable 'port' to silence this warning u32 ip = 0, ip_to = 0, p = 0, port, port_to; ^ = 0 14 warnings generated. vim +/port_to +249 net/netfilter/ipset/ip_set_hash_ipportnet.c 158 159 static int 160 hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], 161 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried) 162 { 163 const struct hash_ipportnet4 *h = set->data; 164 ipset_adtfn adtfn = set->variant->adt[adt]; 165 struct hash_ipportnet4_elem e = { .cidr = HOST_MASK - 1 }; 166 struct ip_set_ext ext = IP_SET_INIT_UEXT(set); 167 u32 ip = 0, ip_to = 0, p = 0, port, port_to; 168 u32 ip2_from = 0, ip2_to = 0, ip2; 169 bool with_ports = false; 170 u8 cidr; 171 int ret; 172 173 if (tb[IPSET_ATTR_LINENO]) 174 *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); 175 176 if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || 177 !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || 178 !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) || 179 !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) 180 return -IPSET_ERR_PROTOCOL; 181 182 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); 183 if (ret) 184 return ret; 185 186 ret = ip_set_get_extensions(set, tb, &ext); 187 if (ret) 188 return ret; 189 190 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2], &ip2_from); 191 if (ret) 192 return ret; 193 194 if (tb[IPSET_ATTR_CIDR2]) { 195 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR2]); 196 if (!cidr || cidr > HOST_MASK) 197 return -IPSET_ERR_INVALID_CIDR; 198 e.cidr = cidr - 1; 199 } 200 201 e.port = nla_get_be16(tb[IPSET_ATTR_PORT]); 202 203 if (tb[IPSET_ATTR_PROTO]) { 204 e.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]); 205 with_ports = ip_set_proto_with_ports(e.proto); 206 207 if (e.proto == 0) 208 return -IPSET_ERR_INVALID_PROTO; 209 } else { 210 return -IPSET_ERR_MISSING_PROTO; 211 } 212 213 if (!(with_ports || e.proto == IPPROTO_ICMP)) 214 e.port = 0; 215 216 if (tb[IPSET_ATTR_CADT_FLAGS]) { 217 u32 cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]); 218 219 if (cadt_flags & IPSET_FLAG_NOMATCH) 220 flags |= (IPSET_FLAG_NOMATCH << 16); 221 } 222 223 with_ports = with_ports && tb[IPSET_ATTR_PORT_TO]; 224 if (adt == IPSET_TEST || 225 !(tb[IPSET_ATTR_CIDR] || tb[IPSET_ATTR_IP_TO] || with_ports || 226 tb[IPSET_ATTR_IP2_TO])) { 227 e.ip = htonl(ip); 228 e.ip2 = htonl(ip2_from & ip_set_hostmask(e.cidr + 1)); 229 ret = adtfn(set, &e, &ext, &ext, flags); 230 return ip_set_enomatch(ret, flags, adt, set) ? -ret : 231 ip_set_eexist(ret, flags) ? 0 : ret; 232 } 233 234 ip_to = ip; 235 if (tb[IPSET_ATTR_IP_TO]) { 236 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to); 237 if (ret) 238 return ret; 239 if (ip > ip_to) 240 swap(ip, ip_to); 241 } else if (tb[IPSET_ATTR_CIDR]) { 242 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]); 243 244 if (!cidr || cidr > HOST_MASK) 245 return -IPSET_ERR_INVALID_CIDR; 246 ip_set_mask_from_to(ip, ip_to, cidr); 247 } 248 > 249 if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE) 250 return -ERANGE; 251 252 port_to = port = ntohs(e.port); 253 if (tb[IPSET_ATTR_PORT_TO]) { 254 port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]); 255 if (port > port_to) 256 swap(port, port_to); 257 } 258 259 ip2_to = ip2_from; 260 if (tb[IPSET_ATTR_IP2_TO]) { 261 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to); 262 if (ret) 263 return ret; 264 if (ip2_from > ip2_to) 265 swap(ip2_from, ip2_to); 266 if (ip2_from + UINT_MAX == ip2_to) 267 return -IPSET_ERR_HASH_RANGE; 268 } else { 269 ip_set_mask_from_to(ip2_from, ip2_to, e.cidr + 1); 270 } 271 272 if (retried) { 273 ip = ntohl(h->next.ip); 274 p = ntohs(h->next.port); 275 ip2 = ntohl(h->next.ip2); 276 } else { 277 p = port; 278 ip2 = ip2_from; 279 } 280 for (; ip <= ip_to; ip++) { 281 e.ip = htonl(ip); 282 for (; p <= port_to; p++) { 283 e.port = htons(p); 284 do { 285 e.ip2 = htonl(ip2); 286 ip2 = ip_set_range_to_cidr(ip2, ip2_to, &cidr); 287 e.cidr = cidr - 1; 288 ret = adtfn(set, &e, &ext, &ext, flags); 289 290 if (ret && !ip_set_eexist(ret, flags)) 291 return ret; 292 293 ret = 0; 294 } while (ip2++ < ip2_to); 295 ip2 = ip2_from; 296 } 297 p = port; 298 } 299 return ret; 300 } 301 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip