CC: kbuild-all(a)lists.01.org CC: Linux Memory Management List TO: Eric Dumazet tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: fbf252e0967821ce890e23359d00c30132876014 commit: 587652bbdd06ab38a4c1b85e40f933d2cf4a1147 [1258/7827] net: gro: populate net/core/gro.c :::::: branch date: 6 hours ago :::::: commit date: 4 weeks ago config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20211217/202112171305.AMUGGrsD-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Julia Lawall cocci warnings: (new ones prefixed by >>) >> net/core/gro.c:493:5-12: ERROR: PTR_ERR applied after initialization to constant on line 441 vim +493 net/core/gro.c 587652bbdd06ab Eric Dumazet 2021-11-15 433 587652bbdd06ab Eric Dumazet 2021-11-15 434 static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 587652bbdd06ab Eric Dumazet 2021-11-15 435 { 587652bbdd06ab Eric Dumazet 2021-11-15 436 u32 bucket = skb_get_hash_raw(skb) & (GRO_HASH_BUCKETS - 1); 587652bbdd06ab Eric Dumazet 2021-11-15 437 struct gro_list *gro_list = &napi->gro_hash[bucket]; 587652bbdd06ab Eric Dumazet 2021-11-15 438 struct list_head *head = &offload_base; 587652bbdd06ab Eric Dumazet 2021-11-15 439 struct packet_offload *ptype; 587652bbdd06ab Eric Dumazet 2021-11-15 440 __be16 type = skb->protocol; 587652bbdd06ab Eric Dumazet 2021-11-15 @441 struct sk_buff *pp = NULL; 587652bbdd06ab Eric Dumazet 2021-11-15 442 enum gro_result ret; 587652bbdd06ab Eric Dumazet 2021-11-15 443 int same_flow; 587652bbdd06ab Eric Dumazet 2021-11-15 444 int grow; 587652bbdd06ab Eric Dumazet 2021-11-15 445 587652bbdd06ab Eric Dumazet 2021-11-15 446 if (netif_elide_gro(skb->dev)) 587652bbdd06ab Eric Dumazet 2021-11-15 447 goto normal; 587652bbdd06ab Eric Dumazet 2021-11-15 448 587652bbdd06ab Eric Dumazet 2021-11-15 449 gro_list_prepare(&gro_list->list, skb); 587652bbdd06ab Eric Dumazet 2021-11-15 450 587652bbdd06ab Eric Dumazet 2021-11-15 451 rcu_read_lock(); 587652bbdd06ab Eric Dumazet 2021-11-15 452 list_for_each_entry_rcu(ptype, head, list) { 587652bbdd06ab Eric Dumazet 2021-11-15 453 if (ptype->type != type || !ptype->callbacks.gro_receive) 587652bbdd06ab Eric Dumazet 2021-11-15 454 continue; 587652bbdd06ab Eric Dumazet 2021-11-15 455 587652bbdd06ab Eric Dumazet 2021-11-15 456 skb_set_network_header(skb, skb_gro_offset(skb)); 587652bbdd06ab Eric Dumazet 2021-11-15 457 skb_reset_mac_len(skb); 587652bbdd06ab Eric Dumazet 2021-11-15 458 NAPI_GRO_CB(skb)->same_flow = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 459 NAPI_GRO_CB(skb)->flush = skb_is_gso(skb) || skb_has_frag_list(skb); 587652bbdd06ab Eric Dumazet 2021-11-15 460 NAPI_GRO_CB(skb)->free = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 461 NAPI_GRO_CB(skb)->encap_mark = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 462 NAPI_GRO_CB(skb)->recursion_counter = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 463 NAPI_GRO_CB(skb)->is_fou = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 464 NAPI_GRO_CB(skb)->is_atomic = 1; 587652bbdd06ab Eric Dumazet 2021-11-15 465 NAPI_GRO_CB(skb)->gro_remcsum_start = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 466 587652bbdd06ab Eric Dumazet 2021-11-15 467 /* Setup for GRO checksum validation */ 587652bbdd06ab Eric Dumazet 2021-11-15 468 switch (skb->ip_summed) { 587652bbdd06ab Eric Dumazet 2021-11-15 469 case CHECKSUM_COMPLETE: 587652bbdd06ab Eric Dumazet 2021-11-15 470 NAPI_GRO_CB(skb)->csum = skb->csum; 587652bbdd06ab Eric Dumazet 2021-11-15 471 NAPI_GRO_CB(skb)->csum_valid = 1; 587652bbdd06ab Eric Dumazet 2021-11-15 472 NAPI_GRO_CB(skb)->csum_cnt = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 473 break; 587652bbdd06ab Eric Dumazet 2021-11-15 474 case CHECKSUM_UNNECESSARY: 587652bbdd06ab Eric Dumazet 2021-11-15 475 NAPI_GRO_CB(skb)->csum_cnt = skb->csum_level + 1; 587652bbdd06ab Eric Dumazet 2021-11-15 476 NAPI_GRO_CB(skb)->csum_valid = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 477 break; 587652bbdd06ab Eric Dumazet 2021-11-15 478 default: 587652bbdd06ab Eric Dumazet 2021-11-15 479 NAPI_GRO_CB(skb)->csum_cnt = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 480 NAPI_GRO_CB(skb)->csum_valid = 0; 587652bbdd06ab Eric Dumazet 2021-11-15 481 } 587652bbdd06ab Eric Dumazet 2021-11-15 482 587652bbdd06ab Eric Dumazet 2021-11-15 483 pp = INDIRECT_CALL_INET(ptype->callbacks.gro_receive, 587652bbdd06ab Eric Dumazet 2021-11-15 484 ipv6_gro_receive, inet_gro_receive, 587652bbdd06ab Eric Dumazet 2021-11-15 485 &gro_list->list, skb); 587652bbdd06ab Eric Dumazet 2021-11-15 486 break; 587652bbdd06ab Eric Dumazet 2021-11-15 487 } 587652bbdd06ab Eric Dumazet 2021-11-15 488 rcu_read_unlock(); 587652bbdd06ab Eric Dumazet 2021-11-15 489 587652bbdd06ab Eric Dumazet 2021-11-15 490 if (&ptype->list == head) 587652bbdd06ab Eric Dumazet 2021-11-15 491 goto normal; 587652bbdd06ab Eric Dumazet 2021-11-15 492 587652bbdd06ab Eric Dumazet 2021-11-15 @493 if (PTR_ERR(pp) == -EINPROGRESS) { 587652bbdd06ab Eric Dumazet 2021-11-15 494 ret = GRO_CONSUMED; 587652bbdd06ab Eric Dumazet 2021-11-15 495 goto ok; 587652bbdd06ab Eric Dumazet 2021-11-15 496 } 587652bbdd06ab Eric Dumazet 2021-11-15 497 587652bbdd06ab Eric Dumazet 2021-11-15 498 same_flow = NAPI_GRO_CB(skb)->same_flow; 587652bbdd06ab Eric Dumazet 2021-11-15 499 ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED; 587652bbdd06ab Eric Dumazet 2021-11-15 500 587652bbdd06ab Eric Dumazet 2021-11-15 501 if (pp) { 587652bbdd06ab Eric Dumazet 2021-11-15 502 skb_list_del_init(pp); 587652bbdd06ab Eric Dumazet 2021-11-15 503 napi_gro_complete(napi, pp); 587652bbdd06ab Eric Dumazet 2021-11-15 504 gro_list->count--; 587652bbdd06ab Eric Dumazet 2021-11-15 505 } 587652bbdd06ab Eric Dumazet 2021-11-15 506 587652bbdd06ab Eric Dumazet 2021-11-15 507 if (same_flow) 587652bbdd06ab Eric Dumazet 2021-11-15 508 goto ok; 587652bbdd06ab Eric Dumazet 2021-11-15 509 587652bbdd06ab Eric Dumazet 2021-11-15 510 if (NAPI_GRO_CB(skb)->flush) 587652bbdd06ab Eric Dumazet 2021-11-15 511 goto normal; 587652bbdd06ab Eric Dumazet 2021-11-15 512 587652bbdd06ab Eric Dumazet 2021-11-15 513 if (unlikely(gro_list->count >= MAX_GRO_SKBS)) 587652bbdd06ab Eric Dumazet 2021-11-15 514 gro_flush_oldest(napi, &gro_list->list); 587652bbdd06ab Eric Dumazet 2021-11-15 515 else 587652bbdd06ab Eric Dumazet 2021-11-15 516 gro_list->count++; 587652bbdd06ab Eric Dumazet 2021-11-15 517 587652bbdd06ab Eric Dumazet 2021-11-15 518 NAPI_GRO_CB(skb)->count = 1; 587652bbdd06ab Eric Dumazet 2021-11-15 519 NAPI_GRO_CB(skb)->age = jiffies; 587652bbdd06ab Eric Dumazet 2021-11-15 520 NAPI_GRO_CB(skb)->last = skb; 587652bbdd06ab Eric Dumazet 2021-11-15 521 skb_shinfo(skb)->gso_size = skb_gro_len(skb); 587652bbdd06ab Eric Dumazet 2021-11-15 522 list_add(&skb->list, &gro_list->list); 587652bbdd06ab Eric Dumazet 2021-11-15 523 ret = GRO_HELD; 587652bbdd06ab Eric Dumazet 2021-11-15 524 587652bbdd06ab Eric Dumazet 2021-11-15 525 pull: 587652bbdd06ab Eric Dumazet 2021-11-15 526 grow = skb_gro_offset(skb) - skb_headlen(skb); 587652bbdd06ab Eric Dumazet 2021-11-15 527 if (grow > 0) 587652bbdd06ab Eric Dumazet 2021-11-15 528 gro_pull_from_frag0(skb, grow); 587652bbdd06ab Eric Dumazet 2021-11-15 529 ok: 587652bbdd06ab Eric Dumazet 2021-11-15 530 if (gro_list->count) { 587652bbdd06ab Eric Dumazet 2021-11-15 531 if (!test_bit(bucket, &napi->gro_bitmask)) 587652bbdd06ab Eric Dumazet 2021-11-15 532 __set_bit(bucket, &napi->gro_bitmask); 587652bbdd06ab Eric Dumazet 2021-11-15 533 } else if (test_bit(bucket, &napi->gro_bitmask)) { 587652bbdd06ab Eric Dumazet 2021-11-15 534 __clear_bit(bucket, &napi->gro_bitmask); 587652bbdd06ab Eric Dumazet 2021-11-15 535 } 587652bbdd06ab Eric Dumazet 2021-11-15 536 587652bbdd06ab Eric Dumazet 2021-11-15 537 return ret; 587652bbdd06ab Eric Dumazet 2021-11-15 538 587652bbdd06ab Eric Dumazet 2021-11-15 539 normal: 587652bbdd06ab Eric Dumazet 2021-11-15 540 ret = GRO_NORMAL; 587652bbdd06ab Eric Dumazet 2021-11-15 541 goto pull; 587652bbdd06ab Eric Dumazet 2021-11-15 542 } 587652bbdd06ab Eric Dumazet 2021-11-15 543 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org