[legion:sysctls-v3 15/30] net/vmw_vsock/af_vsock.c:2849:12: warning: 'vsock_net_child_mode_string' defined but not used

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/legion/linux.git sysctls-v3
head:   b5c5a5b075f61f062cb2d253d35c118b8eecc40b
commit: ae14ad1ad8ce93d5955985cc18d518bd4739585e [15/30] sysctl: net: use ctl_field in vsock sysctls
config: um-randconfig-001-20260814 (https://download.01.org/0day-ci/archive/20260814/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260814/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> net/vmw_vsock/af_vsock.c:2849:12: warning: 'vsock_net_child_mode_string' defined but not used [-Wunused-function]
    2849 | static int vsock_net_child_mode_string(const struct ctl_table *table, int write,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/vmw_vsock/af_vsock.c:2835:12: warning: 'vsock_net_mode_string' defined but not used [-Wunused-function]
    2835 | static int vsock_net_mode_string(const struct ctl_table *table, int write,
         |            ^~~~~~~~~~~~~~~~~~~~~


vim +/vsock_net_child_mode_string +2849 net/vmw_vsock/af_vsock.c

eafb64f40ca49c Bobby Eshleman     2026-01-21  2834  
eafb64f40ca49c Bobby Eshleman     2026-01-21 @2835  static int vsock_net_mode_string(const struct ctl_table *table, int write,
eafb64f40ca49c Bobby Eshleman     2026-01-21  2836  				 void *buffer, size_t *lenp, loff_t *ppos)
eafb64f40ca49c Bobby Eshleman     2026-01-21  2837  {
eafb64f40ca49c Bobby Eshleman     2026-01-21  2838  	struct net *net;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2839  
eafb64f40ca49c Bobby Eshleman     2026-01-21  2840  	if (write)
eafb64f40ca49c Bobby Eshleman     2026-01-21  2841  		return -EPERM;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2842  
5cc619583c7e73 Greg Kroah-Hartman 2026-02-23  2843  	net = container_of(table->data, struct net, vsock.mode);
eafb64f40ca49c Bobby Eshleman     2026-01-21  2844  
eafb64f40ca49c Bobby Eshleman     2026-01-21  2845  	return __vsock_net_mode_string(table, write, buffer, lenp, ppos,
eafb64f40ca49c Bobby Eshleman     2026-01-21  2846  				       vsock_net_mode(net), NULL);
eafb64f40ca49c Bobby Eshleman     2026-01-21  2847  }
eafb64f40ca49c Bobby Eshleman     2026-01-21  2848  
eafb64f40ca49c Bobby Eshleman     2026-01-21 @2849  static int vsock_net_child_mode_string(const struct ctl_table *table, int write,
eafb64f40ca49c Bobby Eshleman     2026-01-21  2850  				       void *buffer, size_t *lenp, loff_t *ppos)
eafb64f40ca49c Bobby Eshleman     2026-01-21  2851  {
eafb64f40ca49c Bobby Eshleman     2026-01-21  2852  	enum vsock_net_mode new_mode;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2853  	struct net *net;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2854  	int ret;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2855  
5cc619583c7e73 Greg Kroah-Hartman 2026-02-23  2856  	net = container_of(table->data, struct net, vsock.child_ns_mode);
eafb64f40ca49c Bobby Eshleman     2026-01-21  2857  
eafb64f40ca49c Bobby Eshleman     2026-01-21  2858  	ret = __vsock_net_mode_string(table, write, buffer, lenp, ppos,
eafb64f40ca49c Bobby Eshleman     2026-01-21  2859  				      vsock_net_child_mode(net), &new_mode);
eafb64f40ca49c Bobby Eshleman     2026-01-21  2860  	if (ret)
eafb64f40ca49c Bobby Eshleman     2026-01-21  2861  		return ret;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2862  
6a997f38bdf822 Stefano Garzarella 2026-02-12  2863  	if (write) {
6a997f38bdf822 Stefano Garzarella 2026-02-12  2864  		/* Prevent a "local" namespace from escalating to "global",
6a997f38bdf822 Stefano Garzarella 2026-02-12  2865  		 * which would give nested namespaces access to global CIDs.
6a997f38bdf822 Stefano Garzarella 2026-02-12  2866  		 */
6a997f38bdf822 Stefano Garzarella 2026-02-12  2867  		if (vsock_net_mode(net) == VSOCK_NET_MODE_LOCAL &&
6a997f38bdf822 Stefano Garzarella 2026-02-12  2868  		    new_mode == VSOCK_NET_MODE_GLOBAL)
6a997f38bdf822 Stefano Garzarella 2026-02-12  2869  			return -EPERM;
6a997f38bdf822 Stefano Garzarella 2026-02-12  2870  
102eab95f025b4 Bobby Eshleman     2026-02-23  2871  		if (!vsock_net_set_child_mode(net, new_mode))
102eab95f025b4 Bobby Eshleman     2026-02-23  2872  			return -EBUSY;
6a997f38bdf822 Stefano Garzarella 2026-02-12  2873  	}
eafb64f40ca49c Bobby Eshleman     2026-01-21  2874  
eafb64f40ca49c Bobby Eshleman     2026-01-21  2875  	return 0;
eafb64f40ca49c Bobby Eshleman     2026-01-21  2876  }
eafb64f40ca49c Bobby Eshleman     2026-01-21  2877  

:::::: The code at line 2849 was first introduced by commit
:::::: eafb64f40ca49c79f0769aab25d0fae5c9d3becb vsock: add netns to vsock core

:::::: TO: Bobby Eshleman <[email protected]>
:::::: CC: Paolo Abeni <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.