tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: f00397ee41c79b6155b9b44abd0055b2c0621349 commit: 908148bc5046e3503f2758d1d94c43766958d5be [4836/5787] tipc: refactor tipc_sendmsg() and tipc_lookup_anycast() config: x86_64-randconfig-m001-20210320 (attached as .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 <lkp@xxxxxxxxx> New smatch warnings: net/tipc/socket.c:1443 __tipc_sendmsg() warn: inconsistent indenting Old smatch warnings: net/tipc/socket.c:1463 __tipc_sendmsg() warn: inconsistent indenting vim +1443 net/tipc/socket.c 1421 1422 static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) 1423 { 1424 struct sock *sk = sock->sk; 1425 struct net *net = sock_net(sk); 1426 struct tipc_sock *tsk = tipc_sk(sk); 1427 struct tipc_uaddr *ua = (struct tipc_uaddr *)m->msg_name; 1428 long timeout = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT); 1429 struct list_head *clinks = &tsk->cong_links; 1430 bool syn = !tipc_sk_type_connectionless(sk); 1431 struct tipc_group *grp = tsk->group; 1432 struct tipc_msg *hdr = &tsk->phdr; 1433 struct tipc_socket_addr skaddr; 1434 struct sk_buff_head pkts; 1435 int atype, mtu, rc; 1436 1437 if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE)) 1438 return -EMSGSIZE; 1439 1440 if (ua) { 1441 if (!tipc_uaddr_valid(ua, m->msg_namelen)) 1442 return -EINVAL; > 1443 atype = ua->addrtype; 1444 } 1445 1446 /* If socket belongs to a communication group follow other paths */ 1447 if (grp) { 1448 if (!ua) 1449 return tipc_send_group_bcast(sock, m, dlen, timeout); 1450 if (atype == TIPC_SERVICE_ADDR) 1451 return tipc_send_group_anycast(sock, m, dlen, timeout); 1452 if (atype == TIPC_SOCKET_ADDR) 1453 return tipc_send_group_unicast(sock, m, dlen, timeout); 1454 if (atype == TIPC_SERVICE_RANGE) 1455 return tipc_send_group_mcast(sock, m, dlen, timeout); 1456 return -EINVAL; 1457 } 1458 1459 if (!ua) { 1460 ua = (struct tipc_uaddr *)&tsk->peer; 1461 if (!syn && ua->family != AF_TIPC) 1462 return -EDESTADDRREQ; 1463 atype = ua->addrtype; 1464 } 1465 1466 if (unlikely(syn)) { 1467 if (sk->sk_state == TIPC_LISTEN) 1468 return -EPIPE; 1469 if (sk->sk_state != TIPC_OPEN) 1470 return -EISCONN; 1471 if (tsk->published) 1472 return -EOPNOTSUPP; 1473 if (atype == TIPC_SERVICE_ADDR) { 1474 tsk->conn_type = ua->sa.type; 1475 tsk->conn_instance = ua->sa.instance; 1476 } 1477 msg_set_syn(hdr, 1); 1478 } 1479 1480 /* Determine destination */ 1481 if (atype == TIPC_SERVICE_RANGE) { 1482 return tipc_sendmcast(sock, &ua->sr, m, dlen, timeout); 1483 } else if (atype == TIPC_SERVICE_ADDR) { 1484 skaddr.node = ua->lookup_node; 1485 ua->scope = tipc_node2scope(skaddr.node); 1486 if (!tipc_nametbl_lookup_anycast(net, ua, &skaddr)) 1487 return -EHOSTUNREACH; 1488 } else if (atype == TIPC_SOCKET_ADDR) { 1489 skaddr = ua->sk; 1490 } else { 1491 return -EINVAL; 1492 } 1493 1494 /* Block or return if destination link is congested */ 1495 rc = tipc_wait_for_cond(sock, &timeout, 1496 !tipc_dest_find(clinks, skaddr.node, 0)); 1497 if (unlikely(rc)) 1498 return rc; 1499 1500 /* Finally build message header */ 1501 msg_set_destnode(hdr, skaddr.node); 1502 msg_set_destport(hdr, skaddr.ref); 1503 if (atype == TIPC_SERVICE_ADDR) { 1504 msg_set_type(hdr, TIPC_NAMED_MSG); 1505 msg_set_hdr_sz(hdr, NAMED_H_SIZE); 1506 msg_set_nametype(hdr, ua->sa.type); 1507 msg_set_nameinst(hdr, ua->sa.instance); 1508 msg_set_lookup_scope(hdr, ua->scope); 1509 } else { /* TIPC_SOCKET_ADDR */ 1510 msg_set_type(hdr, TIPC_DIRECT_MSG); 1511 msg_set_lookup_scope(hdr, 0); 1512 msg_set_hdr_sz(hdr, BASIC_H_SIZE); 1513 } 1514 1515 /* Add message body */ 1516 __skb_queue_head_init(&pkts); 1517 mtu = tipc_node_get_mtu(net, skaddr.node, tsk->portid, true); 1518 rc = tipc_msg_build(hdr, m, 0, dlen, mtu, &pkts); 1519 if (unlikely(rc != dlen)) 1520 return rc; 1521 if (unlikely(syn && !tipc_msg_skb_clone(&pkts, &sk->sk_write_queue))) { 1522 __skb_queue_purge(&pkts); 1523 return -ENOMEM; 1524 } 1525 1526 /* Send message */ 1527 trace_tipc_sk_sendmsg(sk, skb_peek(&pkts), TIPC_DUMP_SK_SNDQ, " "); 1528 rc = tipc_node_xmit(net, &pkts, skaddr.node, tsk->portid); 1529 if (unlikely(rc == -ELINKCONG)) { 1530 tipc_dest_push(clinks, skaddr.node, 0); 1531 tsk->cong_link_cnt++; 1532 rc = 0; 1533 } 1534 1535 if (unlikely(syn && !rc)) 1536 tipc_set_sk_state(sk, TIPC_CONNECTING); 1537 1538 return rc ? rc : dlen; 1539 } 1540 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip