net/ipv4/udp.c:2654 (null)() warn: inconsistent indenting

From: kernel test robot
Date: Sun Aug 29 2021 - 04:13:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3f5ad13cb012939e1797ec9cdf43941c169216d2
commit: af2ac3e13e45752af03c8a933f9b6e18841b128b bpf: Prepare bpf syscall to be used from kernel and user space.
date: 3 months ago
config: nds32-randconfig-m031-20210829 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
net/ipv4/udp.c:2654 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2656 (null)() warn: ignoring unreachable code.

Old smatch warnings:
net/ipv4/udp.c:495 __udp4_lib_lookup() warn: potential spectre issue 'udptable->hash2' [r]
net/ipv4/udp.c:2261 __udp4_lib_mcast_deliver() warn: potential spectre issue 'udptable->hash2' [r]
net/ipv4/udp.c:2487 __udp4_lib_mcast_demux_lookup() warn: potential spectre issue 'udp_table.hash' [r]
net/ipv4/udp.c:2518 __udp4_lib_demux_lookup() warn: potential spectre issue 'udp_table.hash2' [r]
net/ipv4/udp.c:2680 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2684 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2688 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2693 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2700 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2715 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2729 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2739 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2773 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2775 (null)() warn: ignoring unreachable code.
net/ipv4/udp.c:2777 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2781 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2785 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2789 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2793 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2799 (null)() warn: inconsistent indenting
net/ipv4/udp.c:2803 (null)() warn: inconsistent indenting

vim +2654 net/ipv4/udp.c

db8dac20d51993 David S. Miller 2008-03-06 2623
^1da177e4c3f41 Linus Torvalds 2005-04-16 2624 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 2625 * Socket option code for UDP
^1da177e4c3f41 Linus Torvalds 2005-04-16 2626 */
4c0a6cb0db19de Gerrit Renker 2006-11-27 2627 int udp_lib_setsockopt(struct sock *sk, int level, int optname,
91ac1ccaff597d Christoph Hellwig 2020-07-23 2628 sockptr_t optval, unsigned int optlen,
4c0a6cb0db19de Gerrit Renker 2006-11-27 2629 int (*push_pending_frames)(struct sock *))
^1da177e4c3f41 Linus Torvalds 2005-04-16 2630 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2631 struct udp_sock *up = udp_sk(sk);
1c19448c9ba654 Tom Herbert 2014-05-23 2632 int val, valbool;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2633 int err = 0;
b2bf1e2659b1cb Wang Chen 2007-12-03 2634 int is_udplite = IS_UDPLITE(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2635
^1da177e4c3f41 Linus Torvalds 2005-04-16 2636 if (optlen < sizeof(int))
^1da177e4c3f41 Linus Torvalds 2005-04-16 2637 return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2638
91ac1ccaff597d Christoph Hellwig 2020-07-23 2639 if (copy_from_sockptr(&val, optval, sizeof(val)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 2640 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2641
1c19448c9ba654 Tom Herbert 2014-05-23 2642 valbool = val ? 1 : 0;
1c19448c9ba654 Tom Herbert 2014-05-23 2643
^1da177e4c3f41 Linus Torvalds 2005-04-16 2644 switch (optname) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2645 case UDP_CORK:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2646 if (val != 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2647 up->corkflag = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2648 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2649 up->corkflag = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2650 lock_sock(sk);
4243cdc2c1e5a1 Joe Perches 2014-11-11 2651 push_pending_frames(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2652 release_sock(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2653 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 @2654 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2655
^1da177e4c3f41 Linus Torvalds 2005-04-16 @2656 case UDP_ENCAP:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2657 switch (val) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2658 case 0:
fd1ac07f3f17fb Alexey Dobriyan 2019-10-04 2659 #ifdef CONFIG_XFRM
^1da177e4c3f41 Linus Torvalds 2005-04-16 2660 case UDP_ENCAP_ESPINUDP:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2661 case UDP_ENCAP_ESPINUDP_NON_IKE:
0146dca70b877b Sabrina Dubroca 2020-04-27 2662 #if IS_ENABLED(CONFIG_IPV6)
0146dca70b877b Sabrina Dubroca 2020-04-27 2663 if (sk->sk_family == AF_INET6)
0146dca70b877b Sabrina Dubroca 2020-04-27 2664 up->encap_rcv = ipv6_stub->xfrm6_udp_encap_rcv;
0146dca70b877b Sabrina Dubroca 2020-04-27 2665 else
0146dca70b877b Sabrina Dubroca 2020-04-27 2666 #endif
067b207b281db5 James Chapman 2007-07-05 2667 up->encap_rcv = xfrm4_udp_encap_rcv;
fd1ac07f3f17fb Alexey Dobriyan 2019-10-04 2668 #endif
a8eceea84a3a35 Joe Perches 2020-03-12 2669 fallthrough;
342f0234c71b40 James Chapman 2007-06-27 2670 case UDP_ENCAP_L2TPINUDP:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2671 up->encap_type = val;
60fb9567bf3093 Paolo Abeni 2018-11-07 2672 lock_sock(sk);
60fb9567bf3093 Paolo Abeni 2018-11-07 2673 udp_tunnel_encap_enable(sk->sk_socket);
60fb9567bf3093 Paolo Abeni 2018-11-07 2674 release_sock(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2675 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2676 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2677 err = -ENOPROTOOPT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2678 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2679 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2680 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2681
1c19448c9ba654 Tom Herbert 2014-05-23 2682 case UDP_NO_CHECK6_TX:
1c19448c9ba654 Tom Herbert 2014-05-23 2683 up->no_check6_tx = valbool;
1c19448c9ba654 Tom Herbert 2014-05-23 2684 break;
1c19448c9ba654 Tom Herbert 2014-05-23 2685
1c19448c9ba654 Tom Herbert 2014-05-23 2686 case UDP_NO_CHECK6_RX:
1c19448c9ba654 Tom Herbert 2014-05-23 2687 up->no_check6_rx = valbool;
1c19448c9ba654 Tom Herbert 2014-05-23 2688 break;
1c19448c9ba654 Tom Herbert 2014-05-23 2689
bec1f6f697362c Willem de Bruijn 2018-04-26 2690 case UDP_SEGMENT:
bec1f6f697362c Willem de Bruijn 2018-04-26 2691 if (val < 0 || val > USHRT_MAX)
bec1f6f697362c Willem de Bruijn 2018-04-26 2692 return -EINVAL;
bec1f6f697362c Willem de Bruijn 2018-04-26 2693 up->gso_size = val;
bec1f6f697362c Willem de Bruijn 2018-04-26 2694 break;
bec1f6f697362c Willem de Bruijn 2018-04-26 2695
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2696 case UDP_GRO:
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2697 lock_sock(sk);
78352f73dc5047 Paolo Abeni 2021-03-30 2698
78352f73dc5047 Paolo Abeni 2021-03-30 2699 /* when enabling GRO, accept the related GSO packet type */
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2700 if (valbool)
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2701 udp_tunnel_encap_enable(sk->sk_socket);
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2702 up->gro_enabled = valbool;
78352f73dc5047 Paolo Abeni 2021-03-30 2703 up->accept_udp_l4 = valbool;
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2704 release_sock(sk);
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2705 break;
e20cf8d3f1f763 Paolo Abeni 2018-11-07 2706
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2707 /*
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2708 * UDP-Lite's partial checksum coverage (RFC 3828).
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2709 */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2710 /* The sender sets actual checksum coverage length via this option.
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2711 * The case coverage > packet length is handled by send module. */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2712 case UDPLITE_SEND_CSCOV:
b2bf1e2659b1cb Wang Chen 2007-12-03 2713 if (!is_udplite) /* Disable the option on UDP sockets */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2714 return -ENOPROTOOPT;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2715 if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2716 val = 8;
4be929be34f9bd Alexey Dobriyan 2010-05-24 2717 else if (val > USHRT_MAX)
4be929be34f9bd Alexey Dobriyan 2010-05-24 2718 val = USHRT_MAX;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2719 up->pcslen = val;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2720 up->pcflag |= UDPLITE_SEND_CC;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2721 break;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2722
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2723 /* The receiver specifies a minimum checksum coverage value. To make
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2724 * sense, this should be set to at least 8 (as done below). If zero is
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2725 * used, this again means full checksum coverage. */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2726 case UDPLITE_RECV_CSCOV:
b2bf1e2659b1cb Wang Chen 2007-12-03 2727 if (!is_udplite) /* Disable the option on UDP sockets */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2728 return -ENOPROTOOPT;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2729 if (val != 0 && val < 8) /* Avoid silly minimal values. */
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2730 val = 8;
4be929be34f9bd Alexey Dobriyan 2010-05-24 2731 else if (val > USHRT_MAX)
4be929be34f9bd Alexey Dobriyan 2010-05-24 2732 val = USHRT_MAX;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2733 up->pcrlen = val;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2734 up->pcflag |= UDPLITE_RECV_CC;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2735 break;
ba4e58eca8aa94 Gerrit Renker 2006-11-27 2736
^1da177e4c3f41 Linus Torvalds 2005-04-16 2737 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2738 err = -ENOPROTOOPT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2739 break;
6516c65573fde5 Stephen Hemminger 2007-03-08 2740 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2741
^1da177e4c3f41 Linus Torvalds 2005-04-16 2742 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2743 }
c482c568577a2b Eric Dumazet 2009-07-17 2744 EXPORT_SYMBOL(udp_lib_setsockopt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2745

:::::: The code at line 2654 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip