oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [axboe-block:net-accept-more 3/6] net/mptcp/protocol.c:3902:10: warning: variable 'err' is uninitialized when used here
@ 2024-05-10 10:44 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-10 10:44 UTC (permalink / raw)
  To: Jens Axboe; +Cc: llvm, oe-kbuild-all

Hi Jens,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git net-accept-more
head:   3b4f987e70b3ba8a6da0a425daf61c9cac61f55d
commit: 11129a54ba83064e7ba3157cb5d12febfdf813df [3/6] net: change proto and proto_ops accept type
config: powerpc-canyonlands_defconfig (https://download.01.org/0day-ci/archive/20240510/202405101828.RbNqkFlt-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project b910bebc300dafb30569cecc3017b446ea8eafa0)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240510/202405101828.RbNqkFlt-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405101828.RbNqkFlt-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from net/mptcp/protocol.c:11:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/powerpc/include/asm/cacheflush.h:7:
   In file included from include/linux/mm.h:2210:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> net/mptcp/protocol.c:3902:10: warning: variable 'err' is uninitialized when used here [-Wuninitialized]
    3902 |                 return err;
         |                        ^~~
   net/mptcp/protocol.c:3888:9: note: initialize the variable 'err' to silence this warning
    3888 |         int err;
         |                ^
         |                 = 0
   2 warnings generated.


vim +/err +3902 net/mptcp/protocol.c

2303f994b3e187 Peter Krystad  2020-01-21  3882  
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3883  static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
11129a54ba8306 Jens Axboe     2024-05-09  3884  			       struct proto_accept_arg *arg)
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3885  {
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3886  	struct mptcp_sock *msk = mptcp_sk(sock->sk);
1f6610b92ac3c4 Paolo Abeni    2023-08-11  3887  	struct sock *ssk, *newsk;
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3888  	int err;
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3889  
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3890  	pr_debug("msk=%p", msk);
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3891  
5b825727d0871b Paolo Abeni    2023-05-31  3892  	/* Buggy applications can call accept on socket states other then LISTEN
61761231695309 Paolo Abeni    2023-04-14  3893  	 * but no need to allocate the first subflow just to error out.
61761231695309 Paolo Abeni    2023-04-14  3894  	 */
1f6610b92ac3c4 Paolo Abeni    2023-08-11  3895  	ssk = READ_ONCE(msk->first);
1f6610b92ac3c4 Paolo Abeni    2023-08-11  3896  	if (!ssk)
71ba088ce0aa87 Paolo Abeni    2022-01-06  3897  		return -EINVAL;
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3898  
8e2b8a9fa51270 Davide Caratti 2023-12-19  3899  	pr_debug("ssk=%p, listener=%p", ssk, mptcp_subflow_ctx(ssk));
11129a54ba8306 Jens Axboe     2024-05-09  3900  	newsk = inet_csk_accept(ssk, arg);
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3901  	if (!newsk)
e76c8ef5cc5b77 Paolo Abeni    2023-05-17 @3902  		return err;
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3903  
8e2b8a9fa51270 Davide Caratti 2023-12-19  3904  	pr_debug("newsk=%p, subflow is mptcp=%d", newsk, sk_is_mptcp(newsk));
8e2b8a9fa51270 Davide Caratti 2023-12-19  3905  	if (sk_is_mptcp(newsk)) {
8e2b8a9fa51270 Davide Caratti 2023-12-19  3906  		struct mptcp_subflow_context *subflow;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3907  		struct sock *new_mptcp_sock;
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3908  
8e2b8a9fa51270 Davide Caratti 2023-12-19  3909  		subflow = mptcp_subflow_ctx(newsk);
8e2b8a9fa51270 Davide Caratti 2023-12-19  3910  		new_mptcp_sock = subflow->conn;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3911  
8e2b8a9fa51270 Davide Caratti 2023-12-19  3912  		/* is_mptcp should be false if subflow->conn is missing, see
8e2b8a9fa51270 Davide Caratti 2023-12-19  3913  		 * subflow_syn_recv_sock()
8e2b8a9fa51270 Davide Caratti 2023-12-19  3914  		 */
8e2b8a9fa51270 Davide Caratti 2023-12-19  3915  		if (WARN_ON_ONCE(!new_mptcp_sock)) {
8e2b8a9fa51270 Davide Caratti 2023-12-19  3916  			tcp_sk(newsk)->is_mptcp = 0;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3917  			goto tcpfallback;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3918  		}
8e2b8a9fa51270 Davide Caratti 2023-12-19  3919  
8e2b8a9fa51270 Davide Caratti 2023-12-19  3920  		newsk = new_mptcp_sock;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3921  		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPCAPABLEPASSIVEACK);
8e2b8a9fa51270 Davide Caratti 2023-12-19  3922  
11129a54ba8306 Jens Axboe     2024-05-09  3923  		newsk->sk_kern_sock = arg->kern;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3924  		lock_sock(newsk);
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3925  		__inet_accept(sock, newsock, newsk);
0397c6d85f9c6f Paolo Abeni    2020-11-19  3926  
a5ef058dc4d9a3 Paolo Abeni    2022-10-20  3927  		set_bit(SOCK_CUSTOM_SOCKOPT, &newsock->flags);
8e2b8a9fa51270 Davide Caratti 2023-12-19  3928  		msk = mptcp_sk(newsk);
b6985b9b82954c Paolo Abeni    2023-03-09  3929  		msk->in_accept_queue = 0;
a5ef058dc4d9a3 Paolo Abeni    2022-10-20  3930  
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3931  		/* set ssk->sk_socket of accept()ed flows to mptcp socket.
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3932  		 * This is needed so NOSPACE flag can be set from tcp stack.
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3933  		 */
190f8b060ee38f Geliang Tang   2020-08-03  3934  		mptcp_for_each_subflow(msk, subflow) {
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3935  			struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3936  
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3937  			if (!ssk->sk_socket)
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3938  				mptcp_sock_graft(ssk, newsock);
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3939  		}
63740448a32eb6 Paolo Abeni    2023-04-17  3940  
63740448a32eb6 Paolo Abeni    2023-04-17  3941  		/* Do late cleanup for the first subflow as necessary. Also
63740448a32eb6 Paolo Abeni    2023-04-17  3942  		 * deal with bad peers not doing a complete shutdown.
63740448a32eb6 Paolo Abeni    2023-04-17  3943  		 */
39880bd808ad2d Paolo Abeni    2023-08-11  3944  		if (unlikely(inet_sk_state_load(msk->first) == TCP_CLOSE)) {
63740448a32eb6 Paolo Abeni    2023-04-17  3945  			__mptcp_close_ssk(newsk, msk->first,
63740448a32eb6 Paolo Abeni    2023-04-17  3946  					  mptcp_subflow_ctx(msk->first), 0);
39880bd808ad2d Paolo Abeni    2023-08-11  3947  			if (unlikely(list_is_singular(&msk->conn_list)))
c693a851642990 Geliang Tang   2023-12-22  3948  				mptcp_set_state(newsk, TCP_CLOSE);
63740448a32eb6 Paolo Abeni    2023-04-17  3949  		}
8e2b8a9fa51270 Davide Caratti 2023-12-19  3950  	} else {
8e2b8a9fa51270 Davide Caratti 2023-12-19  3951  tcpfallback:
11129a54ba8306 Jens Axboe     2024-05-09  3952  		newsk->sk_kern_sock = arg->kern;
8e2b8a9fa51270 Davide Caratti 2023-12-19  3953  		lock_sock(newsk);
8e2b8a9fa51270 Davide Caratti 2023-12-19  3954  		__inet_accept(sock, newsock, newsk);
8e2b8a9fa51270 Davide Caratti 2023-12-19  3955  		/* we are being invoked after accepting a non-mp-capable
8e2b8a9fa51270 Davide Caratti 2023-12-19  3956  		 * flow: sk is a tcp_sk, not an mptcp one.
8e2b8a9fa51270 Davide Caratti 2023-12-19  3957  		 *
8e2b8a9fa51270 Davide Caratti 2023-12-19  3958  		 * Hand the socket over to tcp so all further socket ops
8e2b8a9fa51270 Davide Caratti 2023-12-19  3959  		 * bypass mptcp.
8e2b8a9fa51270 Davide Caratti 2023-12-19  3960  		 */
8e2b8a9fa51270 Davide Caratti 2023-12-19  3961  		WRITE_ONCE(newsock->sk->sk_socket->ops,
8e2b8a9fa51270 Davide Caratti 2023-12-19  3962  			   mptcp_fallback_tcp_ops(newsock->sk));
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3963  	}
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3964  	release_sock(newsk);
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3965  
e76c8ef5cc5b77 Paolo Abeni    2023-05-17  3966  	return 0;
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3967  }
cf7da0d66cc1a2 Peter Krystad  2020-01-21  3968  

:::::: The code at line 3902 was first introduced by commit
:::::: e76c8ef5cc5b77debe711717f61a3fbf24904873 mptcp: refactor mptcp_stream_accept()

:::::: TO: Paolo Abeni <pabeni@redhat.com>
:::::: CC: Jakub Kicinski <kuba@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-10 10:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 10:44 [axboe-block:net-accept-more 3/6] net/mptcp/protocol.c:3902:10: warning: variable 'err' is uninitialized when used here kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).